Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Good day everyone.
I am working with the Dawn theme. While making some customizations I have added the rendering of "accessories" (products marked as relevant in a new metafield on the relevant product settings page). This is similar to the relevant or recommended products fields that were already present.
My goal is to have an small "add to cart" button beneath every "accessory" thumbnail image, which can add said product to the cart without leaving the product page. So far, I managed to send the relevant ID to the add-to-cart functionality which adds the accessory product to the cart correctly, but the page is then redirected to the shopping cart page (which throws a 302 redirect response).
I tried some Googling and looking through this forum, but I came up blank. Can anyone push me in the right direction as to how I can add a product without redirecting to the shopping cart? Maybe some Ajax code to make adding the product a background process? Although I have very little Ajax experience.
Thanks in advance for any tips or advise!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025