Out of Stock Behavior – Site Builder to SCA
Site Builder allowed for setting OOS behavior for all products; SuiteCommerce eliminated the feature and it is causing us some issues.
WE would like the functionality of “allow Backorders but Display out-of-stock message”…UNLESS the QTY available = 0. At that point, we need the Add to Cart button to be disabled.
This would allow anything added to the cart to be processed through checkout but disallow anyone from adding it to their cart until more inventory is available.
We do not want customers to have to edit the cart if we do not have the quantity they ordered on hand. The reason is, we often have substitutes, or can quickly get the items needed. If it can be added to the cart, the order should go through no matter what.
Does anyone have an idea if this is possible? Any workarounds?
Thanks in Advance
You can use the handlebars to pass a boolean value. You would get the quantity available value by calling the item model (in the view) and then getting that value. Set the handlebar variable to true for any value >= to 0. Then wrap the Add to Cart button in the tpl with that handlebar variable. If the value is true. Then the Add to Cart will show, if it evaluates as false, the Add to Cart button can have the disabled attribute.
Here is a similar example from the cart_add_to_cart_button.tpl:
{{#if showSoldOutButton}}<divclass="cart-add-to-cart-button-container"><divclass="cart-add-to-cart-button"><buttontype="submit"data-type="add-to-cart"data-action="sticky"class="cart-add-to-cart-button-button inactive"disabled="true">{{translate 'Sold Out'}}</button/></div></div>{{/if}}