How we can show the warning message when the response from the suitelet is false.

We can display the warning message in template when the suitelet response is false.

var url = Utils.getAbsoluteUrl(getExtensionAssetsPath("services/Shipping.Service.ss"));
								jQuery.post(url, JSON.stringify(cartObject)).done(function (data) {
									
if (data.success === True) {
} else if (data.success === false) {
												$('.cart-summary-remove-action>i').click();
												var $form = $(data.target).closest('[data-type="cart-summary-total"]');
												var $alert_placeholder = $form.find('[data-type="alert-item-update"]');
												var cartMessage = new GlobalViewsMessageView({
													message: 'We are unable to calculate shipping cost for given address',
													type: 'warning',
													closable: true
												}).render().$el;
												if ($alert_placeholder.length) {
													$alert_placeholder.empty().html(cartMessage);
												} else {
													var $productDetails = jQuery('.cart-summary-button-estimate');
													$('.focused-form-view>div>.global-views-message.global-views-message-warning.alert').length === 0 ? $productDetails.before(cartMessage) : false;
												}
											}

Leave a comment

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