Hello! I am trying to add a version of the “add to cart” button to products on my collection page.
Right now, I have:
-
A button under each product that says “Add a sample”
-
When I click that button:
-
the number of items in the cart, in the top right, is correctly updated.
-
I stay on the collection page instead of getting redirected to the cart or checkout page, as desired.
What I would like to add:
-
I want to trigger the cart drawer to open, like how it works when you add a product to the cart from a product page.
-
I tried following this video to trigger the drawer to open, but the video corresponds to an older version of the Impulse theme.
Here is the code that I have added so far, in product-grid-item.liquid.
Here is what my custom add to cart button looks like currently (in our store’s case, we only want to add a sample). The button looks good as I have it now, I don’t want to show the quantity or other options. I just need to trigger the cart drawer to open when I click this button.
cc: @zimblot

