craftcms / stripe

Sync and extend Stripe products and subscriptions.
MIT License
5 stars 0 forks source link

How to filter to only current subscriptions? #24

Closed andrewfairlie closed 1 week ago

andrewfairlie commented 1 week ago

I would expect

{% set subscription = currentUser.getStripeSubscriptions.status("active").all() %}

To show their active subscriptions, but it shows their cancelled status ones too.

Is there a way to request this, or would it be custom PHP to query it?

i-just commented 1 week ago

Hi, thanks for getting in touch.

The getStripeSubscriptions() method returns a collection, so if you want to filter the results by their Stripe status, you can do so via: {% set subscriptions = currentUser.getStripeSubscriptions().where('stripeStatus', 'active').all() %}

I hope this helps!