Can I create a URL to add autoship products to the cart?

Yes! 

Autoship Cloud uses data attributes to attach a frequency type and frequency to simple and variable products, so to construct an "add-to-cart" url that includes these data attributes is pretty straightforward.

Example: Simple Product URL

Modify the url to include our autoship attributes, so for example say you want to add a product id "11057" to the cart with a quantity of "1", a  frequency type of "Monthly" and frequency of every "5" months: 

https://beautyloop.wpengine.com/?add-to-cart=11057&quantity=1&autoship_frequency_type=Months&autoship_frequency=5

Example: Variable Product URL

This is a little more complicated with product variations.  For more detailed instructions and examples on constructing add-to-cart URLs, you should check out this very helpful article WooCommerce Custom “Add to Cart” URLs – The Ultimate Guide

In this example, we’re modifying the URL to add a Variable Product ID "10995", and specifically its variation ID "10997" where the color attribute is equal to "tan".

https://beautyloop.wpengine.com/?add-to-cart=10995&variation_id=10997&attribute_pa_colour=tan&quantity=1&autoship_frequency_type=Months&autoship_frequency=5

Want to redirect to the cart? Once again this helpful guide provides more examples for modifying the URL to perform the action your want.  Here's the same product variation as above but redirected to the cart in the URL:

https://beautyloop.wpengine.com/cart/?add-to-cart=11057&quantity=1&autoship_frequency_type=Months&autoship_frequency=5

Still need help? Contact Us Contact Us