How to add custom add to cart URL in WooCommerce

By on October 31, 2019

Here you can learn how to add custom “add to cart” URL in WooCommerce Development. This will be very helpful if you need to add “Add to Cart ” button according to your custom needs.

Simple Products


Add Single Simple Product

<a href=”https://youdomainname/?add-to-cart=30″>Add to Cart</a>

30 is the prdouct ID which you want to add into the cart.

Simple Product with Quantity

<a href=”https://youdomainname/?add-to-cart=30&quantity=5″>Add to Cart</a>

30 is the product ID and 5 is the product quantity.

Add Single Simple Product and redirect them to the Cart

<a href=”https://youdomainname/cart/?add-to-cart=30″>Add to Cart</a>

Add Single Simple Product and redirect them to the Checkout Page

<a href=”https://youdomainname/checkout/?add-to-cart=30″>Add to Cart</a>


Variable Products


Add Single Varialbe product into cart

<a href=”https://youdomainname/?add-to-cart=90″>Add to Cart</a>

90 is the variation ID.

Add Single Variable Product to Cart with Quantity

<a href=”http://yourdomainname/?add-to-cart=90&quantity=5″>Add to Cart</a>

90 is the variation ID and 5 is the quantity. You can also redirect to Cart, Checkout and another page like simple products:

Add Single Variable Product to Cart and Redirect to Cart

<a href=”http:// yourdomainname.com/cart/?add-to-cart=90″>Add to Cart</a>

Add Single Variable Product to Cart and Redirect to Checkout

<a href=”http:// yourdomainname.com/checkout/?add-to-cart=90″>Add to Cart</a>

Add Single Variable Product to Cart and Redirect to Any Page

<a href=”http:// yourdomainname.com/anyurl/?add-to-cart=90″>Add to Cart</a>

About Author

author

Recent Comments

    Archives

    %d bloggers like this: