MODULES
...
eCommerce
Subscriptions

User Subscriptions - List the logged in User's Subscription Orders

9min
this article shows you how to use the secure zones layout user subscriptions to list subscription orders belonging to a user introduction this article shows you how to use the secure zones layout user subscriptions to list subscription orders belonging to a user as this is a secure user specific list, the layout is found in the secure zones module this is slightly different from a subscriptions list view, as this lists all available subscription products you can learn more about this here outputting the user subscriptions list the following liquid can be outputted on any page protected by a secure zone {% include 'user subscriptions', layout 'default' %} parameters layout select a layout for this view the user subscriptions layout file structure you can find these layouts at the path layouts/modules/module 5/user subscriptions/ development looping over subscription orders to loop over available subscription orders, you can use the following liquid {% for this in subscription orders %} {% endfor %} inside the loop, you can use the available fields shown below under the this namespace outside of the loop liquid, you can build the html structure which will wrap your layout setting a subscription to cancel at the end of the billing period you can use the following liquid to include a button to either cancel a subscription or stop a pending cancellation read more here {% if and this cancel at period end != 'true' %} {% include 'ecommerce/subscription cancel', orderid this id %} {% elsif this cancel at period end == 'true' %} {% include 'ecommerce/subscription reactivate cancelled', orderid this id %} {% endif %} available fields subscription order {{this}} output all available fields as json {{this created at}} outputs the time when this subscription order was originally created use the date filter with ruby date format to format {{this last edit date}} outputs the last time this subscription order was updated either via the admin, user action, or via stripe webhook use the date filter with ruby date format to format {{this user id}} the id of the customer in siteglide {{this id}} the id of the subscription order in siteglide {{this status}} the previous status of the subscription order before the update that triggered this email {{this cancel at period end}} either 'true', false, or empty if set to 'true' the subscription will be cancelled at the end of the current billing period {{this stripe subscription id}} the id of the subscription in the stripe dashboard {{this stripe plan id}} the stripe id for the plan this subscription order is using this may be an older plan than the current plan used by the subscription product {{this plan chargeable price}} a snapshot of the price of this subscription order's plan this may be an older plan than the current plan used by the subscription product {{this plan display only price}} a snapshot of the display only price of this subscription order's plan this may be an older plan than the current plan used by the subscription product {{this plan chargeable price formatted}} a snapshot of the price of this subscription order's plan this may be an older plan than the current plan used by the subscription product formatted as a decimal (e g 1 00) {{this plan display only price formatted}} a snapshot of the display only price of this subscription order's plan this may be an older plan than the current plan used by the subscription product formatted as a decimal (e g 1 00) {{this plan interval}} a snapshot of the interval of this subscription order's plan this may be an older plan than the current plan used by the subscription product {{this plan interval count}} a snapshot of the interval count of this subscription order's plan this may be an older plan than the current plan used by the subscription product subscription {{this subscription}} output all available fields as json {{this subscription name}} the name of the subscription product {{this subscription\['description']}} {{this subscription\['image']}} {{this subscription\['interval']}} {{this subscription\['interval count']}} {{this subscription\['product code (sku)']}} {{this subscription\['stripe product id (live)']}} the id of the product in stripe live mode {{this subscription\['stripe product id (test)']}} the id of the product in stripe test mode the price of the subscription product per billing period {{context exports currency map data\[this subscription price properties \['module field 14/price 2']]}} {% include 'modules/siteglide ecommerce/ecommerce/price formatter' price data this subscription price properties\['module field 14/price 3'] %} price {{this subscription price currency}} the currency {{this subscription price currency symbol}} the currency symbol {{this subscription price price charge}} the price charged per interval as an integer {{this subscription price price charge formatted}} the price charged per interval as a decimal currency format {{this subscription price price display}} a display only price per interval as an integer e g recommended retail price {{this subscription price price display formatted}} a display only price per interval as a decimal currency format e g recommended retail price tip changes in the pricing plan it's possible to change the price and billing interval of a subscription this change will only affect new subscribers and existing customers will continue on the plan they signed up for originally you can read more about this here ecommerce subscriptions changing the price and billing interval when outputting fields in the user subscriptions view, subscription order fields beginning with the word "plan" will normally be the appropriate choice these will show the price that these users will be paying the original plan when they signed up the other price and interval fields stored against the subscription, could be used to show how much the user is saving on their current plan compared to the current price in the different context of the subscription detail page we give a different recommendation as here it may not always be possible to identify immediately if the user is subscribed to a different plan tip working with the interval fields as you can see below, there are multiple fields involved in storing the interval of charges, which you can use to display the interval in a user friendly way here's one example of using liquid to programmatically decide the format to display the interval {% if this\['interval count'] == "1" %} per {{this\['interval'] | pluralize 1}} {% else %} (every {{this\['interval count']}} {{this\['interval']}}) {% endif %} if the interval count is 1, it will use formatting like "per day" if the interval count is greater than 1, it will use formatting like "every 2 days" check out all the available liquid filters over on the platformos liquid docs