All things Shopify and commerce
Hi everybody,
I am seeking help with my Prestige shop theme. I would like to configure an 'add to Cart' Button on the homepage featured collection - I have searched around a bit and apparently
one would have to edit the HTML code of the liquid.cart file. But that is all the in fo I got.
I looked into the code but could find where this is addressed.
Anyone can offer some help?
My store is
Thanks
Hey you need to enable Add to cart functionality on homepage -
To do so you need to have the following things -
Fetch real Products on homepage using a collection not just with URL. Once you have the products go to your product page and search for <form> with class name 'ProductForm' so copy that form integrate into the products which you're showing on homepage.
Thank you for your suggestion. Could you maybe go more into detail? Where would you suggest putting in the copied code?
Cheers
Regina
Hi - You need to first fetch the collections on homepage using this code
<div class="homepageproducts">
{% for product in collections['homepage-collections'].products %}
<div class="c-upsell__product js-product" data-product-id="{{ product.id}}">
<div class="c-upsell__productImage">
{% comment %} Fetch Product Images{% endcomment %}
{% for image in product.images %}
<img class="c-upsell__innerImage" src="{{ image | img_url: '586x' }}" alt="Product Img" />
{% endfor %}
</div>
{% comment %} Fetch Product title & Price {% endcomment %}
<h2 class="c-upsell__productTitle">{{ product.title }} </h2>
<p class="c-upsell__productPrice"> {{ product.price }}</p>
{% comment %} Add to Cart Button {% endcomment %}
<form method="post" action="/cart/add">
<input type="hidden" name="id" value="{{ product.variants.first.id }}" />
<input min="1" type="number" id="quantity" name="quantity" value="1"/>
<input type="submit" value="Add to cart" class="btn" />
</form>
</div>
{% endfor %}
</div>
Like here i did that. you want to do the same thing ?
@Arslan_Mumtaz please I need to do the same on prestige theme, how did you manage it ?
Thanks for your help
{% comment %} Add to Cart Button {% endcomment %}
<form method="post" action="/cart/add">
<button style="margin-top: 4px;" type="submit" name="add" aria-label="Add to cart" class="ad_to_cart_coll Button Button--primary">
Add to cart</button>
</form>
Add the following code in product-item.liquid
Hi
Would I add the same code to get this onto the debut theme as well?
Thank you
Actually I would like to add a "Buy Now" button to the Debut theme on my home page featured collection.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024