Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

woocommerce custom add cart urls

URL: Add One Simple Product to Cart
href=”https://yourdomain.com/?add-to-cart=25″

URL: Add One Simple Product to Cart with Quantity = 3
href=”https://yourdomain.com/?add-to-cart=25&quantity=3″

URL: Add One Simple Product to Cart & Redirect to Cart Afterwards
href=”https://yourdomain.com/cart/?add-to-cart=25″

URL: Add One Simple Product to Cart & Redirect to Checkout Afterwards
href=”https://yourdomain.com/checkout/?add-to-cart=25″

URL: Add One Simple Product to Cart & Redirect to Any Page Afterwards
href=”https://yourdomain.com/your_custom_page/?add-to-cart=25″

URL: Add One Variable Product to Cart
href=”https://yourdomain.com/?add-to-cart=88″

URL: Add One Variable Product to Cart (with Quantity = 3)
href=”https://yourdomain.com/?add-to-cart=88&quantity=3″

URL: Add One Variable Product to Cart & Redirect to Cart
href=”https://yourdomain.com/cart/?add-to-cart=88″

URL: Add One Variable Product to Cart & Redirect to Checkout
href=”https://yourdomain.com/checkout/?add-to-cart=88″

URL: Add One Variable Product to Cart & Redirect to Any Page
href=”https://yourdomain.com/any-page-url/?add-to-cart=88″

URL: Add a Grouped Product to Cart
You will need the Grouped Product ID, which can be found in the usual way, and also the sub-product IDs. Then, use something like:

href=”https://yourdomain.com/?add-to-cart=3111&quantity[1803]=5&quantity[1903]=2″
 
PREVIOUS NEXT
Tagged: #woocommerce #custom #add #cart #urls
ADD COMMENT
Topic
Name
3+9 =