medusa-dynamic-groups
v0.1.5
Published
Rule-based dynamic customer groups for Medusa v2: condition engine, membership sync, and transition emails.
Maintainers
Readme
medusa-dynamic-groups
Rule-based membership for Medusa customer groups.
Install
Register the plugin and the module with the same options:
plugins: [
{ resolve: "medusa-dynamic-groups", options: { marketing_consent_resolver: "none" } },
],
modules: {
dynamic_groups: {
resolve: "medusa-dynamic-groups/modules/dynamic-groups",
options: { marketing_consent_resolver: "none" },
},
},Run migrations: npx medusa db:migrate.
Lifecycle
- Save draft stores a new rule version and does not change membership or send email.
- Preview evaluates without writes.
- Activate records current Medusa members as bootstrap state. It does not add, remove, or email them.
- Sync now locks the group, recomputes the live diff, and asks for confirmation when removals meet the threshold.
- Disable or delete the plugin config leaves the Medusa customer group in place.
Cart scope
Phase 1 cart rules use the most recently updated incomplete cart.
Consent
Marketing rules are suppressed while marketing_consent_resolver is none. Operational rules send when the customer has an email and is not globally suppressed. Arbitrary customer metadata is not treated as consent unless the resolver is custom.
Delivery
Notifications are at-least-once. A row left in sending past the TTL becomes uncertain and is not resent automatically.
Verified against this repo
linkCustomersToCustomerGroupWorkflowaccepts{ id, add, remove }.- Jobs use
export const config = { name, schedule }. - Admin widget zone is
customer_group.details.after. - Email delivery uses
Modules.NOTIFICATION.createNotifications. - Customer, cart, and order events:
customer.created,customer.updated,cart.created,cart.updated,order.placed. - Verification flags come from
otp_verification.listCustomerVerificationByIdswhen that module is installed. There is no public verification-completed event in customer-registration;customer.verification.completedis subscribed if emitted later.
