WooCommerce Variable Subscription Add to Cart URL’s

If you are ready to take your WooCommerce website to the next level beyond the standard product page layout, you’re going to need to know how to create a link to put a product into the cart. This comes in hand when creating a custom landing page for a single product and you don’t have WooCommerce template functionality at hand. You might also want to redirect the user once they hit the Add Now button. Here’s a great article with a (semi) comprehensive list of custom URLs for adding products to a WooCommerce cart: https://businessbloomer.com/woocommerce-custom-add-cart-urls-ultimate-guide/

For our purposes, I needed to add a custom URL for our Variable Subscriptions, which the above article didn’t address.

WooCommerce Custom Add to Cart URL for Variable Subscriptions

Product ID

The first step is to locate the product ID, found in the list of products:

Once you have the product ID, start the link with the following href:

http://cinchws.com/cart/?add-to-cart=30

Variation ID

The next step is to locate the Variation ID. It’s within the product you want under the variations tab:

We will add &variation_id=idnumber to the end of the url and now looks like this:

https://cinchws.com/cart/?add-to-cart=30&variation_id=12190

Frequency

The final piece to create the URL is to grab the frequency attribute. Open up the variation you want and find it under Subscription Length:

The final URL will add &atrribute_frequency=Duration to the end of the URL like this:

https://cinchws.com/cart/?add-to-cart=30&variation_id=12190&attribute_frequency=Never+Expire

I hope this helps others out there who need to know how to build out a custom add-to-cart link using WooCommerce Subscriptions. Comment below if you found it useful.


Also published on Medium.

Leave a Reply

Your email address will not be published. Required fields are marked *

See if Cinch is right for you.

Ask us anything. Seriously. Like, what is the air speed velocity of an unladen swallow?

Start a chat right now

Or go ahead and Sign up now