Displaying 'in Stock' When Set To 'do Not Track'

Hi - have checked all settings but just can't see how to enable this - my site has no stock status for 'do not track items'. The CS Cart demo store however does display 'in stock' - what am I missing?

Thanks

Hello

Settings->General->Enable inventory tracking

Best regards

Robert

Already is as other items show a stock number

Hello

Problem solved or not?

Best regards

Robert

Confusing but appears when we deselect 'Show number of available products:’ it then shows 'in stock' for do not track items... But low qty items now only show 'in stock' you can't have both?

Hello

Did you disable inventory tracking as mentioned above ?

Best regards

Robert

No disabling that removes all stock status notifications.

But keeping this enabled and disabling 'Show number of available products:’ is also putting some do not track items to 'backorder' if the inventory level is 0. Frustrating....

What code/file outputs this?

Surely it's an easy alteration to have 'in stock' showing all the time for do not track items while others display an exact qty...

OK it took a bit of mental energy but I finally discovered it you edit the theme file /design/themes/responsive/templates/common/product_data.tpl

between line 439 and 440 (just before):

                {/if}
            {else}
                {if (
                        $product_amount > 0

INSERT:

                {else}
                            
                                
                                {__("in_stock")}
                                
                            
                        

I now have a site that shows an 'In stock' label for items set to 'do not track' (inventory left as 0) while 'inventory tracking' and 'Show number of available products:’ are both enabled in settings - rather than no label at all..

Hello

There is tpl hook so use it instead of changing core files.

Best regards

Robert

Hello

There is tpl hook so use it instead of changing core files.

Best regards

Robert

Thanks - OK this is something I need to get my head around. I can see there is the {hook name="products:product_amount"} hook, so I need to create an addon - will my addon then replace all of the code within this hook? Otherwise confused how to edit part of the existing code...

Fair play to you for sussing it out and adding a solution, Im sure it will be handy for many

Hello

You can use the my_changes plugin which is available in standard.

Best regards

Robert

may help

https://docs.cs-cart.com/latest/developer_guide/addons/hooking/index.html

https://docs.cs-cart.com/latest/developer_guide/addons/tutorials/advanced.html

Thanks - OK this is something I need to get my head around. I can see there is the {hook name="products:product_amount"} hook, so I need to create an addon - will my addon then replace all of the code within this hook? Otherwise confused how to edit part of the existing code...

To override it, use the following hook

design/themes/THEME/templates/addons/my_changes/hooks/products/product_amount.override.tpl

Do not forget to clear cache