Configuring 'add to Cart' Button on homepage featured collection - Theme Prestige

Highlighted
New Member
2 0 0

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 

www.XRISIS.af

Thanks

0 Likes
Highlighted
Excursionist
21 1 8

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. 

0 Likes
Highlighted
New Member
2 0 0

Thank you for your suggestion. Could you maybe go more into detail? Where would you suggest putting in the copied code?

Cheers

Regina

0 Likes
Highlighted
Excursionist
21 1 8

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>
0 Likes