Get Checkout status of user is guest or registerd using javascript Magento 2.

  • How to know the Checkout Method Status of the user is Guest or Registered Magento 2?

While working on the checkout page, You can know the current customer is a Guest or registered customer using checking the customer login status. Continue reading “Get Checkout status of user is guest or registerd using javascript Magento 2.”

Display Order Summary in Shipping Step of Checkout magento 2.

You can display Order Summary like Order total, subtotal, discount, and shipping charges on the first step (Shipping step) Of checkout page.

By Default, Order Summary in Shipping step is Disabled and it will be loaded through the abstract-total.js file of Checkout module. Continue reading “Display Order Summary in Shipping Step of Checkout magento 2.”

Get subtotal, shipping total and Grand total in checkout page using js Magento 2.

You can get total related information in the checkout page with a subtotal, shipping charge, grand total using Javascript.

For getting update grand total with the shipping charge and tax total and other info you need to call ‘Magento_Checkout/js/model/totals’ in the JS file.

You need to call totals Objects with a required field,

define([
    'uiComponent',
    'Magento_Checkout/js/model/totals'
], function (Component,totals) {
    'use strict';

    return Component.extend({
        getGrandTotal: function(){
            if (totals.totals()) {
                var grandTotal = parseFloat(totals.totals()['grand_total']);
                return grandTotal;
            }
        },
        getSubTotal: function(){
            if (totals.totals()) {
                var subtotal = parseFloat(totals.totals()['subtotal']);
                return subtotal;
            }
        },
        getShippingAmount: function(){
            if (totals.totals()) {
                var shippingAmount = parseFloat(totals.totals()['shipping_amount']);
                return shippingAmount;
            }
        }
    });
});

You can call above function in template with getGrandTotal(), getShippingAmount() and getSubTotal().