website logo
⌘K
Introduction
PORTAL
Agency Whitelabelling
PAGES
Pages - Accessing Page Data
Pagination Layouts
Page Templates
FORMS
Form Confirmation Pages
Adding a Progress Bar
Adding Custom CSS To Show Form Submit Process
Dynamic Content in Workflow and Autoresponder Emails
How to output Custom Field Set fields in a Form's Custom Layout
Custom JavaScript Validation for Forms
File Upload Previews
FAQ
CATEGORIES
Filtering WebApps and Modules by Categories
Outputting Categories on WebApp / Module / eCommerce Layouts
Outputting Category Fields in any Location
Category Detail Layouts
FAQ
COMPANY INFORMATION
Company Information
SITE SEARCH
Site Search
PUBLIC API/ZAPIER
Zapier - Formatting arrays correctly
Public API/Zapier Changelog
MODULES
Module Marketplace
Building Custom Modules
Siteglide Modules
Front-end Submit Modules
DATA STRUCTURES
Automations
Creating WebApps from the CLI
Field Types
WEBAPPS
Front-end Submit WebApps
Layouts
Search and Filtering
Understanding Custom Field Names and IDs
FAQ
CRM
User Details
User Secure Zones
Storing User's Favourite WebApp / Module Items
User's Form Submissions (Cases)
How Users Edit their Email and Password Front End
Editing a User's CRM record Front End with Custom Field Sets
CLI
Introducing Siteglide CLI
CLI Changelog
Secure Zones with CLI
Page Templates with Siteglide CLI
Pages with Siteglide CLI
Includes with Siteglide CLI
Managing Email Templates
Migrate - Manual Form setup
Migrate - Convert existing Forms
Liquid
Accessing Assets
Liquid Dot Notation
Using WebApp Collections- Tutorial
Using the current_user object with Secure Zones
Preventing Duplicate Content with Query Parameters- Canonical URL and Robots.txt
FAQ
GraphQL
Tutorial Overview
About GraphQL
Tutorial 1- Your First Query
Tutorial 2 - Pagination
Tutorial 3 - Filtering the Results
Tutorial 3 - Answers to the First Filtering Challenge
Tutorial 4 - Advanced Filtering
Tutorial 4 - Challenge Answers
Tutorial 5 - Using Liquid to run GraphQL queries on your Site
Tutorial 6 - Variables
Tutorial 6 - Answers to the Variables Challenge
Tutorial 7 - Sorting
Tutorial 8 - Building a Liquid API GET Endpoint Page powered by GraphQL queries
Best Practice and Performance
Module/WebApp Caching
Getting Started with Liquid Caching - to Reduce Server Response time and Improve Performance
Includes
ecommerce/checkout_standard
Frequently Asked Questions
Using Liquid Logic to Check if a field exists, or is empty on the Front End
How do I learn more about Liquid?
How to setup a multi domain start page
Docs powered by archbee 
32min

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

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:

HTML
|

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.

HTML
|

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:
HTML
|

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:

HTML
|

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.

Updated 19 Oct 2021
Did this page help you?
Yes
No
UP NEXT
Editing the "Subscription User Action Required" System Page and Email
Docs powered by archbee 
TABLE OF CONTENTS
Introduction
Outputting the user_subscriptions List
The user_subscriptions Layout
File Structure
Development
Looping over Subscription Orders
Setting a Subscription to Cancel at the end of the Billing Period
Available Fields