FROM CACHE - en_header

Sold out button should display when product inventory stock below 7 in product grid layout

Solved
Krishna12
Tourist
7 0 1

Hello,

Currently i am using empire theme. I have changed code for sold out condition that if product inverntory stock is below 7 than user not allows to add to cart. sold out button will display there instead of add to cart. 

So this functionality working fine in Product detail page. but i need to do this same functionality while product is in grid layout (product-grid-item.liquid)

Screenshot from 2022-07-01 16-27-10.png

https://supplementxpress.com/search?type=article%2Cpage%2Cproduct&q=APS*+Tribulus*+1500*

 

Here i have searched product for "APS Tribulus 1500" which is below 7 in stock but it allows to add to cart, that should not happen. i want to show sold out there.

  I have attached file as well. 

Can someone please help me on this asap.

 

 

Thank you !

Accepted Solution (1)

Accepted Solutions
LitCommerce
Astronaut
2083 489 476

This is an accepted solution.

Hi @Krishna12,

Please add code here:

Screenshot.png

Code:

{% if product.selected_or_first_available_variant.inventory_quantity < 7 %}
          {% assign quick_buy_text = 'product.buttons.sold_out' | t %}
          {% assign quick_buy_classes = quick_buy_classes | append: ' disabled' %}
{% endif %}

Hope it helps!

 

LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool.
Effortlessly sell on biggest marketplaces like Amazon, Etsy, eBay, Facebook etc with bulk listing tool, real-time sync & smart order management. Use LitCommerce free for 1-year now!

View solution in original post

Replies 2 (2)
LitCommerce
Astronaut
2083 489 476

This is an accepted solution.

Hi @Krishna12,

Please add code here:

Screenshot.png

Code:

{% if product.selected_or_first_available_variant.inventory_quantity < 7 %}
          {% assign quick_buy_text = 'product.buttons.sold_out' | t %}
          {% assign quick_buy_classes = quick_buy_classes | append: ' disabled' %}
{% endif %}

Hope it helps!

 

LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool.
Effortlessly sell on biggest marketplaces like Amazon, Etsy, eBay, Facebook etc with bulk listing tool, real-time sync & smart order management. Use LitCommerce free for 1-year now!
Krishna12
Tourist
7 0 1

Code is working. Thank you for your help