cancel
Showing results for 
Search instead for 
Did you mean: 

Qty left in product page

SOLVED

Qty left in product page

Hi,

 

Right now I have enabled the X left Threshold in Magento 2 which will show the qty left if I have less than 10 items in stock.

 

But I also what to display >10 in stock or >50 in stock.

I have been trying to do this, but could not figure out how.

Does anyone have an idea how to do this?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Qty left in product page

Hi @robertbits ,

 

This information is rendering on the product page from below Phtml file

\vendor\magento\module-catalog-inventory\view\frontend\templates\stockqty\default.phtml

 

Override this file in your custom theme

\app\design\frontend\ThemeVendor\ThemeName\Magento_CatalogInventory\templates\stockqty\default.phtml

Add your conditions in the above phtml file.

In admin,

  • Step 1: On the Admin Panel, go to Stores > Settings > Configuration
  • Step 2: On the left panel, go to Catalog > Inventory
  • Step 3: Enter the number as 50 in the Display X left Threshold field. 
  • Step 4: This will render corresponding phtml file when product qty is less than 50.
  • Step 5: You can modify the conditions to render the message in the above phtml file.

Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!

 

View solution in original post

2 REPLIES 2

Re: Qty left in product page

Hi @robertbits ,

 

This information is rendering on the product page from below Phtml file

\vendor\magento\module-catalog-inventory\view\frontend\templates\stockqty\default.phtml

 

Override this file in your custom theme

\app\design\frontend\ThemeVendor\ThemeName\Magento_CatalogInventory\templates\stockqty\default.phtml

Add your conditions in the above phtml file.

In admin,

  • Step 1: On the Admin Panel, go to Stores > Settings > Configuration
  • Step 2: On the left panel, go to Catalog > Inventory
  • Step 3: Enter the number as 50 in the Display X left Threshold field. 
  • Step 4: This will render corresponding phtml file when product qty is less than 50.
  • Step 5: You can modify the conditions to render the message in the above phtml file.

Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!

 

Re: Qty left in product page

@Nishu Jindal Thanks for your help I really appreciate it. What I was doing wrong was that I didn't change the X threshold qty