How to prevent customers from purchasing the same subscription twice in FluentCart?
Hi everyone,
I'm using FluentCart with Stripe to sell a recurring subscription.
During testing, I discovered that a customer who already has an active subscription can purchase the exact same subscription product again, using the same WordPress account.
I tested this successfully, and FluentCart allowed two active subscriptions for the same customer and product.
Is there a native FluentCart setting to prevent this?
I would like customers with an active subscription to be blocked from purchasing the same subscription again, to avoid duplicate recurring charges.
Is this expected behavior, a known issue, or something that requires custom development?
Thanks for your help!
Nancy AharpourΒ FluentCart doesnβt currently have a built-in option to prevent a customer with an active subscription from purchasing the same subscription again. Thanks for the suggestion, weβll share it with our team as a feature request for consideration.
Sujoy Chandra DasΒ Thank you for confirming!
Since this is a recurring subscription with Stripe, allowing customers to purchase the same subscription multiple times could result in duplicate recurring charges.
While waiting for this feature to be implemented, I'd like to create a custom solution to prevent this.
Could you please recommend the official FluentCart hook or filter to use for blocking checkout when a customer already has an active subscription to the same product?
Ideally, the validation should happen server-side, before the order and Stripe subscription are created.
I'd also appreciate any guidance on the recommended way to check a customer's existing active subscriptions using FluentCart's APIs or models.
Nancy AharpourΒ
The recommended server-side hook is fluent_cart/checkout/validate_before_process. It runs before FluentCart creates the order and before the payment gateway, including Stripe, is called. The validation can check the current FluentCart customerβs subscriptions and return a WP_Error if the customer already has an active subscription to the same product.
FluentCart provides the CustomerResource::getCurrentCustomer() method and the customerβs subscriptions() relationship for this. The subscription query can match either the product_id to block the whole product, or the variation_id if only the same plan should be restricted. For the status check, the recommended helper is Status::getValidableSubscriptionStatuses(), which covers active and trialing subscriptions by default.
The alternative fluent_cart/checkout/validate_data filter can also be used if the validation should be added alongside the normal checkout field errors.
Your custom-coded implementation should also be tested on a staging site first.Β
CartCubes Toolbox has a Block Purchases tool that can stop checkout by email, IP, WordPress role, or FluentCRM list and tag:Β https://cartcubes.com/fluentcart/toolbox/tools/block-purchases/
That tool does not yet check for an active subscription on the same product. If you are interested in the addon, I can add that setting.