We can select the shipping method we want based on the conditions using the code instead of selecting the shipping method by clicking on it in the website checkout page.
The shipping method can be set using the setShipMethod()
This method sets a shipping method on the order for all items in the cart. Use getShipMethods() to get available shipping methods. If you pass in an invalid ship method ID, an error is returned.
This method will not work if the Multiple Ship To feature is enabled in the NetSuite account.
Note: This method is only available on the Checkout pages of a SuiteCommerce website.
var cart = container.getComponent("Cart");
var shipMethodId = '2910';
var shipMethodData = {ship_method: {internalid: shipMethodId}};
cart.setShipMethod(shipMethodData).then(function() {
cart.showMessage({
message: 'Shipping method of the order was updated.',
type: 'info'
})
});