What's your biggest current challenge? Have your say in Community Polls along the right column.

Add to cart button on collection page needs to show pop-up instead of redirecting to cart page

Add to cart button on collection page needs to show pop-up instead of redirecting to cart page

ElliotM
Shopify Partner
8 0 0

Hi there,

 

i have created a custom add to cart button on my collection page.

 

Schermafbeelding 2022-06-02 om 23.28.15.png

 

I need the add to cart button to show a pop-up (added to cart) instead of redirecting to the cart page.

 

Schermafbeelding 2022-06-02 om 23.36.21.png

 

The same as the product page add to cart button actually.

 

I use DAWN theme.

 

How can i achieve this?

 

Code used: 

 <form class="add-to-cart-form" method="post" action="/cart/add">
    <input type="hidden" name="id" value="{{ product.variants.first.id }}" />
    <input type="submit" value="{% if product.variants.first.available or product.variants.last.available %}{% else %}{% endif%}" class="buy-button-below-product" {% unless product.variants.first.available or product.variants.last.available  %}disabled{% endunless %} />
  </form>

 

The cart/add action is wrong in this usecase i think.

 

 

Thanks alot!

Replies 2 (2)

diego_ezfy
Shopify Partner
2970 571 917

@ElliotM 

Unfortunately there is no simple way to achieve this, it would require a custom coded solution.

ElliotM
Shopify Partner
8 0 0

Can someone help me with this?