Checkout update for SCMA site

Display the message in checkout page if the order total is less than $1,800.

In extension Extend the view OrderWizard.Module.CartSummary.added the message section in theme.

JJ.CheckoutUpdate.CheckoutUpdate.js: 'OrderWizard.Module.CartSummary'
OrderWizardModuleCartSummary
_.extend(OrderWizardModuleCartSummary.prototype, {
  getContext: _.wrap(OrderWizardModuleCartSummary.prototype.getContext, function(fn) {
    var context = fn.apply(this, _.toArray(arguments).slice(1));
    var showTotalMessage = false;
    var totalMessage = "Order doesn't meet $1,800 minimum for free freight. Add more items or contact Customer Support for options.";
    console.log("originelret", context);
    try {
      var totalAmount = context.model.get('summary').total;
      console.log("totalamount", totalAmount);
      if (totalAmount < 1800) {
        console.log("totalamount", totalAmount);
        showTotalMessage = true;
      }
    } catch (error) {}
    context.showTotalMessage = showTotalMessage;
    context.totalMessage = totalMessage;
    return context;
  })
});
order_wizard_cart_summary.tpl
{{#if showTotalMessage}}
  <div class="order-wizard-cart-summary-warning cart-total-warning" role="alert">
    <div>{{totalMessage}}</div>
  </div>
{{/if}}
_order-wizard-cart-summary.scss

.order-wizard-cart-summary-warning.cart-total-warning div {
    padding-right: 0;
}

Leave a comment

Your email address will not be published. Required fields are marked *