Reputation: 621
I can hard code an add to cart url, it works just fine.
<a href="' . get_home_url() . '/product/myproduct/?add-to-cart=101">Add to cart</a>
However, I'd like to know if I can add the quantity to this query string? Say, like:
<a href="' . get_home_url() . '/product/myproduct/?add-to-cart=101&quantity=2">Add to cart</a>
Is this even possible and I just don't know the right query string word for quantity? Thanks.
Upvotes: 7
Views: 15916
Reputation: 19
But with the ajax call "get_refreshed_fragments" its double the quantity
Upvotes: 0
Reputation: 11425
Yes, quantity
will work, and you can use any base url (home for example), then, by default it will redirect to your cart page.
<a href="' . get_home_url() . '?add-to-cart=101&quantity=2">Add to cart</a>
Upvotes: 14