BackOrder Message

We are using Community Store 2.2.7. and when selecting “allow backorder” we like to put a message on the product page showing it’s a backorder.

Below the code for telling it is out of stock.
<p class="store-out-of-stock-label alert alert-warning <?= ($isSellable ? 'hidden' : ''); ?>"><?= t("Out of Stock"); ?></p>

I don’t know were to start. Searched for BackOrder but couldn’t find anything usefull.

Anywhere you’ve got a $product object, you can call:

$allowBackorders = $product->allowBackOrders();

And then conditionally output a message based on the true/false of $allowBackorders.
So that would need to be on a custom product block template.

1 Like

Thank you! Works great.

   $allowBackorders = $product->allowBackOrders();
   if ($allowBackorders == 1) { ?>
   <p class="alert alert-warning"><?= t("YOUR TEXT"); ?></p>
   <?php }
      else {