Thank you so much, I am having a lot of trouble with this. Is there a link format that will add to the cart without redirecting to the cart page? I have a very strange corner case I need for a few products and have to manually code an add to cart button. Also if you have know of any sort of documentation for this, I cant find it anywhere.
Usually this is done via JS, using Ajax Cart or alike.
Because if you follow a link, then you’re leaving the current page. Shopify supports a return_to parameter to instruct the system to redirect you back after adding to cart, but this is cumbersome and not pleasant experience.
Your theme includes necessary code for adding to cart with JS, just needs proper configuration/modification.
There is a ‘Quick add to cart’ option for product grids and ‘Featured product’ section when you want to showcase a single product, it could be that the reasonable solution would not require any coding.
Thanks @tim_1 that is helpful. So for my case it is a subscription only type store but with every subscription app I have tried it can not be configured to the quick add button on a collection page. . So far I have been able to add the code
which works to add the selected product to the cart with its associated subscription, but I can not figure out how to add the quantity part or keep it from redirecting. I am not very knowledgable with js or ajax but could learn if this would be the only way to fix the problem. If you have any suggestions or recommendations at all I would love to hear them.