gform_stripe_subscriptions_self_serve_markup

Description

The gform_stripe_subscriptions_self_serve_markup filter in Gravity Forms allows filtering the subscriptions list markup or the no subscriptions found markup generated from the shortcode action stripe_customer_portal_link before it is outputted.

Usage

Apply to all forms

add_filter( 'gform_stripe_subscriptions_self_serve_markup', 'your_function_name', 10, 3 );

You can also specify this per form by adding the form id after the hook name.

add_filter( 'gform_stripe_subscriptions_self_serve_markup_7', 'your_function_name', 10, 3 );

Parameters

  • $markup string
    This list markup.
  • $subscriptions array
    Subscription information
  • $form_id integer
    Form ID related to subscriptions

Examples

This example shows how to append a link to the markup in order to direct users to your create a subscription page when they have no subscription.

// Add a link to create a subscription if no subscriptions found
add_filter(  'gform_stripe_subscriptions_self_serve_markup', function( $markup, $subscriptions, $form_id ) {

   if ( empty( $subscriptions ) ) {
      $markup .= '<br><a href="{some_url}">Create a subscription now!</a>';
   }

   return $markup;

}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms Stripe Add-On 4.2.

Source Code

This filter is located in GF_Stripe_Billing_Portal in gravityformsstripe/includes/class-gf-stripe-billing-portal.php.