Add to cart from collection and stay on page

Topic summary

Main issue: Add-to-cart + quantity selectors on collection (product grid) pages break layout and redirect off the page. Reported effects: either only one product shows per row with the button beside it, or three per row but quantity/ADD TO CART sends users to the product page.

Proposed direction: Edit the theme’s collection template to correctly render the grid and handle quantity/add-to-cart without redirect. Multiple requests for store URLs to diagnose; a homepage link was provided. The original poster asked for concrete implementation steps.

Related case: Another store needs an add-to-cart inside a popup (for add-on products) that doesn’t reload or redirect, matching PDP (product detail page) behavior. The recommendation is to use Ajax add-to-cart (adding items asynchronously so users stay on the same page).

Resources shared: Code gist and a blog tutorial for Ajax add-to-cart on collection pages, plus a YouTube walkthrough. Offers for paid customization were made; more details/quotes were requested.

Status: No confirmed fix posted. Key open items: specific theme code changes for the collection grid and integrating Ajax add-to-cart for both the collection page and popup scenarios.

Summarized with AI on January 7. AI used: gpt-5.

Hello,

I have been searching far and wide for a solution to my problem which is adding an ‘ADD TO CART’ + ‘QUANTITY’ selector buttons under each product. I have managed to find coding that helps with that, unfortunately when applying the code the following things happen:

  1. Instead of having 3 items per roll, only 1 appears and the ADD TO CART option is on the side of it

  2. 3 items per roll, ADD TO CART is right below it, but when trying to adjust quantity or pressing ADD TO CART, it redirects me to the product page.

Please help with this issue.

1 Like

Hello MaanShaer,

This can be fixed through editing the theme code to manage the collection page layout as well as to stay on collection page for entering the quantity and adding to cart without redirecting to product page.

Hope this is helpful!

Cheers!

@MaanShaer

Sorry you are facing this issue, it would be my pleasure to help you.

Welcome to the Shopify community! :blush:
Thanks for your good question.

Please share your site URL,
I will check out the issue and provide you a solution here.

This is the link to my homepage:

https://bggiftbox.com/

Hello,

Can you provide some info on how to deal with the issues ?

Hi Ketan. I’m having the same problem with the add-to-cart button on collection pages that are redirecting me to the cart. I don’t want it to do this. Did you have any solution?

1 Like

@Smokelab

Sorry you are facing this issue, it would be my pleasure to help you.

Welcome to the Shopify community! :blush:
Thanks for your good question.

Please share your site URL,
I will check out the issue and provide you a solution here.

1 Like

Hi.

You can try here: https://shishaking.no/products/vannpipe-el-badia-c7-svart

First, press the add to cart button on this product page. You will get a popup. In this popup is another add to cart button(its for add-on oroduct/accessory). I want that this button let’s the user stay on the page without redirect or page-refresh so that I can insert several products in this popup. Possible?

Thanks.

1 Like

@Smokelab

do you need ajax add to cart

1 Like

Yes I think that’s what I need. Can you help me create an add to cart button with Ajax? I think the rest of the site uses Ajax (on PDPs) but since this is a new add to cart button I’ve created, I did this with html, created a form. So I want with Ajax, no redirect and no reloading of the page.

1 Like

@Smokelab

yes it can be done customization code you have hire shopify expert or me also try this solution

https://gist.github.com/marioloncarek/84ccd82a37e864b1959f630f58497733

https://lucidpolygon.com/blog/adding-an-add-to-cart-button-to-collection-pages-in-debut-theme-ajax/

how much would you charge for creating an add to cart button inside my
popup, that does not reload the page, redirect to cart or close my popup?
Just a simple a2c button that acts exactly like the a2c buttons on the PDPs.

1 Like

@Smokelab

yes please sent more details

Hi @MaanShaer , having trouble placing an “Add to Cart” button on your Shopify collection pages? Find a solution in this YouTube video: https://www.youtube.com/watch?v=s98l1bUZe6k