Setting the default subscription plan by passing an URL parameter

Would you like to set the default subscription plan by passing an URL parameter to forms?

What is the use case?

Imagine you have a subscription form with a plan selector containing several subscription plans.

If you’d like to set the default subscription plan by passing an URL parameter, like on the screenshot below, then this article is for you: WP Full Stripe - Subscription plan passed as URL parameter

How to implement it

If you’d like to set the default subscription plan of your subscription form via an URL parameter, then you have to do the following:

  1. Pass the subscription plan id in the wpfsPlan URL parameter.
  2. Implement a Wordpress filter that processes the URL parameter.
    (Default implementation provided below)

The following subsections explain these steps in detail.

1) Pass the plan id in the wpfsPlan URL parameter

You have to pass the plan id in the wpfsPlan parameter, like this (you can try it): https://demo.paymentsplugin.com/sell-recurring-services-inline/?wpfsPlan=silver

You can obtain the plan id on the “Full Stripe / Subscriptions / Subscription Plans” page in WP admin, or on the “Billing / Products” page on the Stripe dashboard.

2) Implement a Wordpress filter to process the URL parameter

For the sake of security, the plugin doesn’t let anyone set the default subscription plan without your consent.

You can give consent by implementing a short piece of code to approve the plan in the form of a Wordpress filter. The code needs to be added to the functions.php file of your active Wordpress theme.

This is the default implementation:

You can customize the code depending on your needs. For example, you can limit the default plan based on form name and plan id:

Still not finding the solution?

Our support team is happy to help you.

Contact support

Feature requests are always welcome!
We consider each feature request carefully, and examine how it fits the roadmap for the plugin.