diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index 7a0b60c760956737ff6d178faaa8528a8754d470..7b679f3799b38a47b07585c1e46d16323f580948 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -69,6 +69,7 @@ define( template: 'Magento_Checkout/shipping' }, visible: ko.observable(!quote.isVirtual()), + errorValidationMessage: ko.observable(false), isCustomerLoggedIn: customer.isLoggedIn, isFormPopUpVisible: formPopUpState.isVisible, isFormInline: addressList().length == 0, @@ -100,12 +101,16 @@ define( stepNavigator.registerStep('shipping', 'Shipping', this.visible, 10); } - this.isFormPopUpVisible.subscribe(function(value) { + this.isFormPopUpVisible.subscribe(function (value) { if (value) { self.getPopUp().openModal(); } }); + quote.shippingMethod.subscribe(function (value) { + self.errorValidationMessage(false); + }); + return this; }, @@ -195,7 +200,7 @@ define( emailValidationResult = customer.isLoggedIn(); if (!quote.shippingMethod()) { - alert($t('Please specify a shipping method')); + this.errorValidationMessage('Please specify a shipping method'); return false; } diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping.html index 0ecaf1d41f6c19b6ceda402911c12075636b9051..8a0cac3f8742f03cf1ad8374c0cbafdbbef879c2 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping.html @@ -126,6 +126,11 @@ <!-- ko template: getTemplate() --><!-- /ko --> <!-- /ko --> </div> + <!-- ko if: errorValidationMessage().length > 0 --> + <div class="message notice"> + <span><!-- ko text: $t(errorValidationMessage())--><!-- /ko --></span> + </div> + <!-- /ko --> <div class="actions-toolbar" id="shipping-method-buttons-container"> <div class="primary"> <button data-role="opc-continue" type="submit" class="button action continue primary">