Change how inventory level shows on site

Solved

Change how inventory level shows on site

magikartcards
Excursionist
19 0 3

Hello!

 

I'm using the feature on Dawn theme to display inventory. I only want the inventory count to show if the item stock is equal or less than a quantity of 10.

 

How would I go about doing this in the code? Can someone please assist with this? 

 

Thank you!

Accepted Solution (1)

suyash1
Shopify Partner
11076 1365 1746

This is an accepted solution.

@magikartcards you can edit product liquid file,

for product variant check inventory_quantity and

if this inventory_quantity is less than 10 then display the number.

To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com

View solution in original post

Replies 10 (10)

suyash1
Shopify Partner
11076 1365 1746

This is an accepted solution.

@magikartcards you can edit product liquid file,

for product variant check inventory_quantity and

if this inventory_quantity is less than 10 then display the number.

To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com
magikartcards
Excursionist
19 0 3

How would I do this? I don't know the right area to edit the code.

suyash1
Shopify Partner
11076 1365 1746

@magikartcards if you can accept me as collaborator then I can check it and let you know 

To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com
magikartcards
Excursionist
19 0 3

Here is the request code 4664

suyash1
Shopify Partner
11076 1365 1746

@magikartcards - what is your website link?

To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com
magikartcards
Excursionist
19 0 3
suyash1
Shopify Partner
11076 1365 1746

@magikartcards - can you please share a product whose inventory is less than 10?

To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com
suyash1
Shopify Partner
11076 1365 1746

@magikartcards  - please check DM

To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com

devcoders
Shopify Partner
1597 189 488

Hello @magikartcards 

Steps to Display Inventory Count Only When Stock is 10 or Less

  1. Go to your Shopify Admin
  2. Navigate to Online Store > Themes
  3. Click on Customize for your active theme
  4. Click on Edit Code
  5. Find and open the file: main-product.liquid
  6. Look for the existing inventory display code, usually within {% if product.variants.first.inventory_quantity > 0 %}
  7. Replace or modify it with the following:

 

 

{% if current_variant.inventory_quantity <= 10 and current_variant.inventory_quantity > 0 %}
<p class="inventory-count">
Hurry! Only {{ current_variant.inventory_quantity }} left in stock.
</p>
{% endif %}

 

 

Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at devcodersp@gmail.com
WhatsApp No: +91 8516919310 If my assistance was helpful, please consider liking and accepting the solution. Thank you!
magikartcards
Excursionist
19 0 3

Hi, thank you for the response. I am having trouble finding the right area to change this code.

 

My website is:

https://magikartcards.com/

 

Would you be able to assist with finding the right spot to paste the code? There is no password. I appreciate your help!