How to skip the two step checkout when using sn_sc.CartJS()

ramesh_r
Mega Sage

Hi,

The below script is working fine when I set the following properties as false  the (glide.sc.checkout.twostep)

 

But i don't want to set the properties to false and also the below script should work. can you help me how to skip the two-step checkout when using sn_sc.CartJS()

createItem: function(current) {

        var data = JSON.parse(current.variables.test_variable);
        for (var i = 0; i < data.length; i++) {
            var dataSet = {};
            dataSet.requested_for = data[i].requested_for.toString();
            dataSet.name = data[i].name.toString();
            dataSet.number = data[i].number.toString();
            var arraydata = '[' + JSON.stringify(dataSet) + ']';

            var approver = this.getManager(data[i].requested_for);
            gs.info("approver==" + arraydata);

            var cart = new sn_sc.CartJS();
            var item = {
                'sysparm_id': '1aa391712fb2011009d159ab2799b676',
                'sysparm_quantity': '1',
                'get_portal_messages': true,
                'variables': {
                    'parent': 'No',
                    'approver': approver.toString(),
                    'company': current.variables.company.toString(),
                    'test_variable': arraydata

                }

            };

            var cartDetails = cart.addToCart(item);
            var checkoutInfo = cart.checkoutCart();
        }
    },

 

Thanks

2 REPLIES 2

Community Alums
Not applicable

Hi, Can you help me how to user this script in my above function

 

Thanks