Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
App for Add to Cart Buttons on Home Page & Collections Page ?
@Arjun086 no need for an app.
{%- if product_card_product.variants.size == 1 -%}
<form method="post" action="/cart/add" class="ContactForm center">
<input type="hidden" name="id" value="{{ product_card_product.variants.first.id }}" />
<input min="1" type="hidden" id="quantity" name="quantity" value="1"/>
<input type="submit" value="Add to cart" class="button" style="margin-top:7px;" />
</form>
{%- else -%}
<div class="center">
<input type="button" class="button" style="margin-top:7px;" onclick="location.href='{{ product_card_product.url | default: '#' }}'" value="View Options" />
</div>
{%- endif -%}
I mean having add to cart button visible on products in homepage and collections page so that the buyer can directly click on it instead of clicking on the product. For reference attaching samples.
Home Page
Collections Page
Hello @Arjun086
Yes you can add to cart without app on collections and homepage grid using @shadowsfall118 reply.
But if you are using Ajax cart drawer then it will need changes in JS too.
Let me know if you need any help.
Hello, any idea about Supply theme?
It doesn't have product-card file.
Hi! I don't seem to see the product-card.liquid, help? I'm on Brooklyn.
Hi @Arjun086, solve the issue of adding an "Add to Cart" button on your Shopify collection pages with the step-by-step guidance provided in this YouTube video: https://www.youtube.com/watch?v=s98l1bUZe6k