cancel
Showing results for 
Search instead for 
Did you mean: 

Stock quantity 0

Re: Stock quantity 0


@Mayur Bhuva wrote:

@Jojobaa

 

Where do you exactly want to show the text?

 

Beside name in product detail page?

Beside SKU?

Beside Availability: InStock?

 

Let me know the exact section where you want to show the text so I can guide you that particular file where you can add this text.


 

@Mayur Bhuva

 

Thanks for your reply.

It should be exactly between the price and SKU. See screeshot: http://prntscr.com/l0gln1
(So only for products that are inStock but with quantity 0 or lower).

Thanks so far. 

Re: Stock quantity 0

Hello @Jojobaa

 

Try this

 

<referenceContainer name="product.info.price">
            <block class="Magento\Framework\View\Element\Template" name="custom.text" template="Vendor_Module::/your-text.phtml" />
        </referenceContainer>

        <move element="custom.text" destination="product.info.price" before="product.info.stock.sku" />
If you find my answer useful, Please click Kudos & Accept as Solution.

Re: Stock quantity 0

@Mayur Bhuva

 

Hi, and thanks for the example. I'm not sure where to put this code? And it seems to be a code to show text, it would be better if it where a custom image.

 

Regards

Re: Stock quantity 0

Hello @Jojobaa

 

Put the above code in a catalog_product_view.xml file

E.g.

app/design/frontend/vendor/theme/Magento_Catalog/layout/catalog_product_view.xml

 

<?xml version="1.0"?>

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="product.info.price">
            <block class="Magento\Framework\View\Element\Template" name="custom.text" template="Vendor_Module::/your-text.phtml" />
        </referenceContainer>

        <move element="custom.text" destination="product.info.price" before="product.info.stock.sku" />
    </body>
</page>
If you find my answer useful, Please click Kudos & Accept as Solution.