Question

I'm trying to get the Add to cart button to appear on products that are Out of stock. I've already set the System->Configuration->Catalog->Inventory->Backorders=Allow Qty Below 0

My store previously did not allow back orders. If I add the following code:

<?php echo $this->getChildHtml('addtocart') ?>

The Add to cart appears on products that are In Stock but does not appear on products that are Out of stock.

Troubleshooting:

  • Inventory > Stock Options > Display Out of Stock Products is set to YES
  • Cleared all cache var/cache, var/session, restarted httpd
  • Re-indexed all indexes
  • Tried using default theme with same result

Still no success and as pointed out by Simon this is not a new problem. What I am having trouble understanding is why there would be the option(s) to Allow back orders and Allow stock level quantities to go bellow 0 and not have the Add to cart button.

UPDATE II

I downloaded and installed the latest version of Magento, did a fresh installation, added 2 products, one with inventory (In stock) the other without (Out of stock) have set Allow Qty Bellow 0, Show products out of stock and the same problem.

Would appreciate an explanation and a solution to this problem.

Was it helpful?

Solution 2

Solution

After much, much testing here is how you can have the Add to cart button appear on products that are Out of stock.

  1. Set System->Configuration->Catalog->Inventory->Backorders=Allow Qty Below 0
  2. Set System->Configuration->Catalog->Inventory->Stock Options->Display Out of Stock Products=Yes
  3. Since Magento will not allow you to change the Qty for Item's Status to Become Out of Stock option to go bellow 0 (cannot put a negative value) it is necessary to run the following SQL statement from your phpmyadmin panel:

    UPDATE core_config_data SET value = '-1' WHERE path = 'cataloginventory/item_options/min_qty';

  4. Verify the setting has been added: System->Configuration->Catalog->Inventory verify that Qty for Item's Status to Become Out of Stock is now -1 (negative one)

  5. Set all store products to In stock: Catalog->Manage Products, Select all products -> Select "Actions"->Update Attributes -> Submit, Select Inventory -> Stock Availability = In Stock -> SAVE

  6. Re-index all indexes.

  7. Now that all products are In Stock and we now have a new rule for that will only set the products Out of stock when the value goes bellow zero (our setting is -1 [minus one]) it is now necessary to modify the theme in the front end.

list.phtml and view.phtml both contain IF statements that create a condition that if the product is "In Stock" then display the Add to cart, this needs to be removed now that the site has been modified in order to display for all products.

Example:

This code

<div class="add-to-box">
  <?php if($_product->isSaleable()): ?>     
  <?php echo $this->getChildHtml('addtocart') ?>
  <?php endif; ?>
</div>

Becomes this

<div class="add-to-box">
<?php echo $this->getChildHtml('addtocart') ?>
</div>

An alternative way to display out of stock and In stock using QTY and not stock status:

<?php $_product = $this->getProduct() ?>
<?php if((int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty() < 1): ?>
<p><strong>
  <?php echo $this->__('Out of stock') ?>
</strong></p>
<?php else: ?>
<p>
  <?php echo $this->__('In Stock')?>
</p>
<?php endif; ?> 

Very surprised that it is this time consuming to allow visitors to purchase products that are out of stock. Hope this helps someone and you won't need to use your bounty to get it done.

OTHER TIPS

Unfortunately, you are not missing a step here. Normally, people would think that the following two configuration options are enough to make it happen:

  1. Set System - Configuration - Catalog - Inventory - Stock Options - Display Out of Stock Products to Yes.
  2. Set System - Configuration - Catalog - Inventory - Product Stock Options - Backorder to Allow Qty Below 0.

You of course also have to make sure that the same settings are set in the specific product or that the product is configured to use the config settings.

Unfortunately, this is not true. So that it really works, the availability of the product has to be set to In Stock. Otherwise, Magento will not show the add to cart button and will not let you buy the product. This alone would maybe not be a problem if you could configure Magento not to set the product to Out of Stock each time it is ordered and falls below the Qty for Item's Status to Become Out of Stock barrier. But this is not possible. For the smart guys out here: No, it is also not possible to set this setting to a quantity below 0 via the admin settings.

Possibilities:

  1. You could fix the issue that the product is set to Out of Stock by fixing the config entry in the database: UPDATE `core_config_data` SET `value` = '-9999' WHERE `path` = 'cataloginventory/item_options/min_qty';. Although this then applies to all products, not only to the ones which are configured for backorders.
  2. You could try one of the "Preorder" or "Backorder" extensions.
  3. You could set the product to In Stock manually each time such an order occurs (of course only possible for very rare cases).

There is an option available in admin.

Just go to your manage product page and in inventory tab you can find

Backorders dropdown

, choose allow quantity below 0 option and save, now customer can order out of stock product also.

You also need to configure your store to display out of stock products:

Go to System > Configuration > Catalog | Inventory > Stock Options and set Display Out of Stock Products to Yes

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top