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 Pay - 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 recurring price 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 recurring price id in the wpfsPlan URL parameter

You have to pass the recurring id in the wpfsPlan parameter (it will select the Silver plan): https://demo.paymentsplugin.com/sell-recurring-services-inline/?wpfsPlan=price_1JmD2iKit80XPxkD8jLNNvVM

You can obtain the recurring price id under the “Products” menu on the Stripe dashboard, in the “Pricing” section of the product details page: WP Full Pay - Get the recurring price id in the 'Pricing' section of the product details page

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 recurring price 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.