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

Re: How to display available size on collection page

How to display available size on collection page

GeminiAtelier
Excursionist
38 0 6

Hi,

 

I am trying to display the available sizes for the products on the collection pages, so the customer does not have to click the product to see if the size is available.

 

Example below:
Screenshot 2024-07-31 at 2.07.37 PM.pngScreenshot 2024-07-31 at 2.08.53 PM.png

Thank you,

Replies 7 (7)

dws_pvt_ltd
Shopify Partner
369 69 88

Hello @GeminiAtelier, Please share your store URL and password.
So that I will check and let you know the exact solution here.

Helpful? then please Like and Accept the Solution.
For any inquiries, please feel free to contact via WhatsApp and Email: sales@dolphinwebsolution.com.
For more information visit our website Dolphin Web Solution Pvt Ltd.
GeminiAtelier
Excursionist
38 0 6

Hi,

 

Thank you, the store url is www.geminiatelier.com and there is no password.

dws_pvt_ltd
Shopify Partner
369 69 88

Hello @GeminiAtelier, It works with the filters user applies In stock filter enable and can see only in stock available products only.

It works perfect i think!!.

Helpful? then please Like and Accept the Solution.
For any inquiries, please feel free to contact via WhatsApp and Email: sales@dolphinwebsolution.com.
For more information visit our website Dolphin Web Solution Pvt Ltd.
GeminiAtelier
Excursionist
38 0 6

Hi,

 

I do not wish the use the filter, I want a solution where the available sizes are written under the products on the collection pages and the "in stock" sizes are highlighted. As on the images attached below:

Screenshot 2024-07-31 at 2.07.37 PM.pngScreenshot 2024-07-31 at 2.08.53 PM.png

 

Huptech-Web
Shopify Partner
1169 234 265

Hey @GeminiAtelier, here are the code and steps to how to add the code 

1. Update the main-collection-product-grid.liquid file

Rishihuptech_0-1722430343296.png

 

1. Go to your Online Store
2. Click on "Themes"
3. Select "Edit code"
4. Open your main-collection-product-grid.liquid file. and added your code the same as the Image After <li> and before <ul>

 

{% if request.page_type == 'collection' %}
  {% if product.variants.size > 1 %}
    <div class="variant-selector">
      <form action="/cart/add" method="post">
        <select name="id">
          {% for variant in product.variants %}
            {% if variant.available %}
              <option value="{{ variant.id }}">{{ variant.title }}</option>
            {% else %}
              <option disabled="disabled">{{ variant.title }} - Sold Out</option>
            {% endif %}
          {% endfor %}
        </select>
        <input type="submit" value="Add to Cart" class="add-to-cart-button" />
      </form>
    </div>
  {% else %}
    <form action="/cart/add" method="post">
      <input type="hidden" name="id" value="{{ product.variants.first.id }}" />
      <input type="submit" value="Add to Cart" class="add-to-cart-button" />
    </form>
  {% endif %}
{% endif %}

2. Add Styling to Your CSS File

1. Go to your Online Store
2. Click on "Themes"
3. Select "Edit code"
4. Open your CSS file. If you have a custom CSS file, open that instead.
5. If you can't find your custom CSS file, open "base.css"
6. Add the following code at the end of the file.

.product-card {
  height: auto !important;
}

.variant-selector {
  display: block !important;
  margin-top: 10px;
}

.add-to-cart-button {
  background-color: #333;
  color: #fff;
  padding: 10px 15px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.add-to-cart-button:hover {
  background-color: #fff;
  color: #333;
  border: 1px solid #333;
}

 
If you need further assistance, please let me know. If you found my help useful, consider liking this message and marking it as the solution.
Thank you 
K.K

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
GeminiAtelier
Excursionist
38 0 6

Screenshot 2024-07-31 at 3.10.32 PM.pngScreenshot 2024-07-31 at 3.11.16 PM.png

 

Hi,

 

I have done the changes in the code but it does not show anything on the website. My theme is Reformation.

kristianh
Visitor
2 0 0

Hi, did you find a solution - I have the same wish?