Skip to content

SwftSubscriptions

Subscription product support for Swft Checkout. Enables WooCommerce Subscriptions (or WooCommerce Simple Subscriptions) products to go through the Swft checkout flow, with recurring billing handled via Stripe’s subscription APIs.

  • Detects subscription products in the cart
  • Passes subscription billing interval, period, and trial data through the session
  • Creates a Stripe SetupIntent (for future billing) instead of a PaymentIntent when the cart is subscription-only
  • Creates a PaymentIntent + SetupIntent for mixed carts (subscription + regular products)
  • After payment, creates a Stripe Customer and Subscription
  • Syncs subscription state to WooCommerce Subscriptions
PluginStatus
WooCommerce SubscriptionsSupported
WooCommerce Simple SubscriptionsSupported
YITH WooCommerce SubscriptionsPartial (contact support)
  1. Install and activate WooCommerce Subscriptions (or compatible plugin)
  2. Download swft-subscriptions.zip from swft.co.uk/modules
  3. Install and activate SwftSubscriptions

Go to WooCommerce → Settings → SwftSubscriptions:

SettingOptionDefault
Enable trial period displayswft_subs_show_trialyes
Trial labelswft_subs_trial_labelFree for {days} days, then {price}/{period}
Cancel at period endswft_subs_cancel_at_period_endno

SwftSubscriptions adds the following to extensions.subscription in the session when the cart contains a subscription product:

{
"product_id": 101,
"type": "subscription",
"billing_period": "month",
"billing_interval": 1,
"trial_length": 14,
"trial_period": "day",
"initial_amount": 0,
"recurring_amount": 2999,
"currency": "GBP",
"sign_up_fee": 0
}

The checkout frontend reads this to:

  • Replace the pay button label: Start free trial / Subscribe — £29.99/mo
  • Show a trial period notice below the pay button
  • Use a SetupIntent flow instead of PaymentIntent for zero-amount initial charges
SetupIntent created → customer enters card → Stripe charges initial amount
→ Stripe Customer created → Stripe Subscription created
→ WooCommerce Subscription activated
SetupIntent created → customer enters card → card saved, no charge
→ Stripe Customer created → Stripe Subscription created with trial_end date
→ Trial billing fires automatically at trial end
→ WooCommerce Subscription activated

Mixed cart (subscription + regular products)

Section titled “Mixed cart (subscription + regular products)”
PaymentIntent created for regular items → SetupIntent for subscription card
→ Both confirmed in one Stripe Elements flow
→ Regular order + Subscription created in WooCommerce
Meta keyValue
_swft_ext_subscriptionFull subscription data as JSON
_swft_stripe_customer_idStripe Customer ID
_swft_stripe_subscription_idStripe Subscription ID
// Modify subscription extension data before it is sent
add_filter( 'swft_subscription_extension_data', function( array $data, WC_Product $product ): array {
return $data;
}, 10, 2 );
// Fired after the Stripe Subscription is created
add_action( 'swft_subscription_created', function( string $stripe_sub_id, int $wc_order_id ): void {
// sync to your CRM
}, 10, 2 );
// Fired when a subscription renewal payment succeeds (Stripe webhook)
add_action( 'swft_subscription_renewed', function( string $stripe_sub_id, int $wc_order_id ): void {
// update member access
}, 10, 2 );
// Fired when a subscription is cancelled
add_action( 'swft_subscription_cancelled', function( string $stripe_sub_id, int $wc_subscription_id ): void {
// revoke access
}, 10, 2 );