Magento 2 – How to Get an Event After Shipping Address Form

checkoutevent-observermagento2shipping-address

There is an event triggered after filling the form of the first checkout phase?

If there is an event is possible to capture the information from the form?

Thanks in advance for any suggestions.

Best Answer

There isn't an event for this case, unless you're asking about a javascript event (the onhashchange event could be used).

You could instead create a plugin for the saveAddressInformation method of the Magento\Checkout\Model\ShippingInformationManagement class. This is where the address information gets added to the quote after the shipping information form is submitted.

Here's how you would get the shipping address in the plugin

public function beforeSaveAddressInformation($subject, $cartId, $addressInformation)
{
    $shippingAddress = $addressInformation->getShippingAddress();

    // Do something

    return null;
}
Related Topic