0

I am trying to do a custom check for the pin code associated with the selected shipping address in the checkout shipping step.

When a person clicks 'Next' I want to do a custom check whether the delivery for that pin code is available or not.

Currently I have tried every possible way of using JavaScript or jQuery click events to trigger on the next button click, but nothing worked.

As far as I noticed, Magento does an internal REST API call to the shipping information endpoint and after that it goes to the payment and billing section.

Can anyone help?

1

When the address-details are changed the event checkout_controller_onepage_save_shipping_method is fired. It will help you to achieve your goal.

  • i have tried with checkout_controller_onepage_save_shipping and controller_action_predispatch_checkout_onepage_save_shipping events but none worked. I had setup logger in those observer but no events were recoded. – kaushik kumar roy Aug 12 '18 at 17:26
1

Use this checkout_controller_onepage_save_shipping_method event in your etc/events.xml and then do your task inside events. You can use Below observer code

<?php
namespace Playing\HelloWorld\Observer;
class ChangeDisplayText implements Magento\Framework\Event\ObserverInterface
{
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
  $displayText = $observer->getData();  

  return $this;
 }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.