[memb_keap_list_subscriptions]

Description

Lists the current member's Keap subscriptions with a self-service cancel button. Paste the shortcode bare and you get a designed table: status, amount, billing cycle, paid-through and next bill dates, and the card on file, with a Cancel button on every subscription that can still be cancelled.

You control the presentation at three levels. Shortcode attributes pick the layout and columns: layout chooses table, cards, rows, or plain, and fields selects columns from a typed field registry. CSS re-themes the shipped look through custom properties. A PHP template in your theme rebuilds the markup entirely, on the same contract the built-ins use.

Subscription data is cached per contact for five minutes, so page renders do not hit the Keap API every time. The cache is cleared the moment a subscription is cancelled through the button.

The cancel button appears only on active subscriptions with no end date. Cancelling with immediate="no" (the default) stops the subscription at the end of the current billing period; immediate="yes" deactivates it right away. On a successful cancel the member is redirected to success_url, the tag_id tag is applied, and the shortcode renders a notice on return.

When the list comes back empty, empty_text shows in its place. If Keap cannot be reached, the shortcode renders nothing rather than telling the member they have no subscriptions.

Any content placed between the opening and closing tags is ignored; all customization happens through attributes, CSS, or templates.

Pair with [memb_keap_add_creditcard] to let members replace a failing card themselves.

Shortcode Examples

The default table:

[memb_keap_list_subscriptions]

Cards instead of a table:

[memb_keap_list_subscriptions layout="cards"]

Choose the columns and their order:

[memb_keap_list_subscriptions fields="status,billing_amount,next_bill_date,card"]

Active subscriptions only, oldest first:

[memb_keap_list_subscriptions status="active" order_by="start_date" sort="asc"]

A read-only list with its own empty-state message:

[memb_keap_list_subscriptions cancel="no" empty_text="No subscriptions yet."]

Shortcode Parameters

cancel

Show the cancel button on cancellable subscriptions. Set no for a read-only list. Default: yes.

confirm

Show a JavaScript confirmation dialog before the cancel is submitted. Default: yes.

date_format

PHP date format applied to every date field. Default: M j, Y.

debug

Prepend a count of subscriptions before and after filtering, plus a list of any ignored fields keys with the valid alternatives. Super admins only. Default: no.

empty_text

Message shown in place of the list when the member has no subscriptions after filtering. Default: You have no subscriptions..

fields

Comma-separated field keys that choose which columns appear and in what order, e.g. fields="status,billing_amount,next_bill_date". Unknown keys are dropped, and an att where every key is unknown falls back to the default set, so a typo never empties the table. See Fields below for the keys and their types. Default: status,billing_amount,billing_cycle,paid_thru_date,next_bill_date,card.

immediate

yes deactivates the subscription immediately; no cancels it at the end of the current billing period. Default: no.

layout

table, cards, rows, or plain. table renders a real HTML table; the other three share one stacked markup that the stylesheet turns into the shipped looks. plain enqueues no CSS, so a page builder container or your own stylesheet dresses the bare structure. Unrecognized values fall back to table. Default: table.

only_ids

Comma-separated Keap plan IDs or product IDs. When set, only subscriptions on those plans or products are listed. Default: ''.

order_by

Field to sort on: id, plan_id, product_id, billing_amount, billing_cycle, billing_frequency, quantity, start_date, last_bill_date, next_bill_date, or end_date. Unrecognized values fall back to start_date. Default: start_date.

sort

Sort direction: asc or desc. Default: desc (newest first).

status

active, inactive, or all. Unrecognized values behave as all. Default: all.

success_url

URL the member is sent to after a successful cancellation. Default: the current page.

failure_url

URL the member is sent to when a cancellation fails. Default: the current page.

tag_id

Torii tag ID applied to the member after a successful cancellation. Default: 0 (none).

template

Render through a named template instead of the built-in layout skeleton. See Customizing with Templates below. Default: ''.

Fields

The list draws its columns from a registry of typed fields. The type decides how a value renders, so dates, amounts, and statuses come out consistent wherever they appear.

Field Type Shows
status enum Active or Inactive
billing_amount money The price, localized to two decimals, no currency symbol
billing_cycle enum Daily, Weekly, Monthly, or Annually
paid_thru_date date Last paid day: the day before the next bill
next_bill_date date Date of the next charge
card text The card on file, e.g. Visa •••• 4242
id text Keap subscription ID
plan_id text Keap subscription plan ID
product_id text Keap product ID
start_date date Date the subscription started
last_bill_date date Date of the most recent charge
end_date date Date the subscription is set to end; empty while active
quantity int Quantity on the subscription
billing_frequency int Number of cycles between bills
auto_charge bool Yes or No
active bool Keap's own active flag, Yes or No

Date fields follow date_format and render in the site locale. Keap subscription dates are calendar dates, so they display without a timezone shift. The card text comes from the member's cached Keap card records, matched to the subscription's payment method.

Customizing with CSS

Every opinion in the shipped stylesheet is a custom property on the .torii-list--v1 wrapper, so a few lines in Additional CSS re-theme the whole list:

.torii-list--v1 {
    --torii-list-accent: #C2410C;
    --torii-list-radius: 10px;
    --torii-list-font-size: 0.95rem;
}
Token Controls Default
--torii-list-accent Accent color for buttons and focus outlines #2271b1
--torii-list-border Hairline borders #dcdcde
--torii-list-alt-bg Even-row striping #f6f7f7
--torii-list-radius Corner rounding 6px
--torii-list-row-gap Gap between rows in the cards and rows layouts 0
--torii-list-font-size List text size inherit
--torii-list-empty-color Empty-state text #50575e

The markup underneath is a stable contract you can build on. The wrapper carries torii-list, torii-list--keap-subscriptions, torii-list--v1, and a layout class; the --v1 namespace is frozen, so a future markup revision ships beside it rather than replacing it. Each row carries data-status, data-active, and data-subscription-id. Each cell carries data-field and data-label, which is what restacks the table into labeled rows under 640px with no JavaScript. Dates render as <time> elements with machine-readable datetime attributes, amounts as <data> elements carrying the raw value.

CSS restyles, hides, reorders, and restacks. It cannot change labels, date formats, or row logic; those belong to the fields and date_format attributes, or to a template. The tokens are shared by every Torii list shortcode, so one snippet re-themes them all.

Customizing with Templates

For full control, rebuild the list with a PHP template in your theme. Set template="my-subs" and Torii looks for torii/shortcodes/keap/subscriptions/my-subs.php in your theme (child theme first). The built-in skeletons are shared by every Torii list shortcode and live in the plugin's templates/shortcodes/list/ directory: copy table.php or stacked.php out of there and edit a working starting point. You can also override a built-in by name: your theme's table.php wins over the plugin's.

Templates receive $atts, $content, $code, and $data. The first three pass through from the shortcode; $data carries the prepared list:

Key Holds
entity Dashed entity slug for class names, keap-subscriptions
layout Layout name
fields Ordered field definitions, each with key, type, and label
items Prepared rows: attrs_html (escaped row attributes), fields (each field's raw value, display text, typed html, and label), and actions_html (the prebuilt cancel form)
atts The resolved shortcode attributes
empty_text The empty-state message
class Extra wrapper classes
has_actions Whether any row carries an action
actions_label Translated label for the actions column
namespace Branding namespace, for __() calls

If the named template exists nowhere, members see nothing and super admins see a Template Missing warning. The general workflow is documented in Shortcode Templates.

Shortcode Attributes

Attribute Value
Conditional No
Nestable No
Accepts formatting No