0

I am using magento 2.3.2 and I am trying set backorder allow below quantity 0 and manage stock yes, but in frontend outof stock product add to cat button not showing.

0

For Backorders, you need to set below things in product

Stock Status : In Stock

Quantity : 0

Advanced Inventory > Backorders : Allow QTY Below 0.

Save Product

That's it. After making above change in any product that product you can add in cart from frontend.

If you'll set Stock Status : Out of stock then Magento will not display "Add to cart" button and "QTY" input box. Because here in this file there is one condition $_product->isSaleable() this will return false if we select Out of stock in product. So just set In Stock in Stock Status and check that will work.

You can refer these both files

vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml

Check this condition in above file

<?php if (!$block->hasOptions()) :?>
    <?= $block->getChildHtml('product_info_form_content') ?>
<?php else :?>
    <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1') :?>
        <?= $block->getChildChildHtml('options_container') ?>
    <?php endif;?>
<?php endif; ?>

vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

Hope this will works for you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.