# Sync WooCommerce Memberships with Discourse groups

**URL:** https://meta.discourse.org/t/sync-woocommerce-memberships-with-discourse-groups/118485
**Category:** Extras
**Tags:** pavilion
**Created:** [May 23, 2019, 7:13am UTC](https://meta.discourse.org/t/sync-woocommerce-memberships-with-discourse-groups/118485 "2019-05-23T07:13:06Z")
**Posts on this page:** 1
**Showing post:** 37

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [March 29, 2022, 7:07am UTC](https://meta.discourse.org/t/sync-woocommerce-memberships-with-discourse-groups/118485/37 "2022-03-29T07:07:52Z")

</div>

In order to sync groups between WooCommerce and Discourse you need to have some custom code. the [WP Discourse](https://github.com/discourse/wp-discourse) plugin won’t do it by itself. You’ve most likely got an implementation of the functions described here.

> [@Manage group membership in Discourse with WP Discourse SSO](https://meta.discourse.org/t/managing-discourse-group-membership-with-wp-discourse-sso/74724):
>
> [WP Discourse](https://github.com/discourse/wp-discourse) functions The [WP Discourse](https://github.com/discourse/wp-discourse) plugin has a couple of functions that can be used to associate WordPress users with Discourse groups. These functions are only enabled on sites that are using WordPress as the SSO provider for Discourse. add\_user\_to\_discourse\_group( $user\_id, $group\_names ) [View Code](https://github.com/discourse/wp-discourse/blob/main/lib/utilities.php#L278-L301) remove\_user\_from\_discourse\_group( $user\_id, $group\_names ) [View Code](https://github.com/discourse/wp-discourse/blob/main/lib/utilities.php#L303-L326) Each of these functions take the same two parameters: $user\_id: the WordPress user’s id $group\_names: a comma separat…

You’ll need to first identify how the sync is happening (It’s not just the [WP Discourse](https://github.com/discourse/wp-discourse) plugin) before I can help you further.

---

_[View the full topic](https://meta.discourse.org/t/sync-woocommerce-memberships-with-discourse-groups/118485)._
