IN THIS ARTICLE
Add payment plan to landing page
To select a product and payment plan, you do not need to use the default WooCommerce product pages but instead can add a custom link to a button or another text link on a landing page.
You can create an add-to-cart link for a specific payment plan of a product by adding the add-to-cart, product_id, and convert_to_sub_ parameters in your link.
Here are the query parameters to use when building your “Add to Cart” link:
- add-to-cart
- product_id
- convert_to_sub_
https://yoursite.com/?add-to-cart={product ID}&convert_to_sub_{product ID}={payment plan}
For a product with the ID 150 that has a payment plan for 4 monthly payments, the URL would be:
https://yoursite.com/?add-to-cart=150&convert_to_sub_150=1_month_4
How can I find the product ID?
On your WordPress dashboard, go to Products > All Products. Next, hover over a specific product and it will reveal the product ID.
If you are using a variation, you have to edit the product and then find the variation.
How can I automatically redirect the user to the Cart page after adding a product to the Cart?
- On your WordPress dashboard, go to WooCommerce > Settings
- Next, click the Products tab
- Then, click the Add to cart behavior tab and turn on Redirect to the cart page after successful addition
- Finally, test this with a specific page. After clicking the link, you will be directed to the Cart page
Additional examples
Example – 12 weekly payments
- Product ID: 30
- Payment Plan: 12 weekly payments
https://yoursite.com/?add-to-cart=30&convert_to_sub_30=1_week_12
Example – 5 yearly payments
- Product ID: 150
- Payment Plan: 5 yearly payments
https://yoursite.com/?add-to-cart=150&convert_to_sub_150=1_year_5
Example – 10 daily payments
- Product ID: 150
- Payment Plan: 10 daily payments
https://yoursite.com/?add-to-cart=150&convert_to_sub_150=1_day_10