I have a custom module with a custom section in Checkout Payment Step.

enter image description here

I want to display the xip code of the customer in the custom section ( both customer logged in and logged out case).

I have used the below code

if ($this->customerSession->isLoggedIn()) {
    if ($customer) {
        $billingAddress = $customer->getDefaultBillingAddress();
        if ($billingAddress) {
            return $billingAddress->getPostcode();
} else {
    $postCode = $this->checkoutsession->getQuote()->getShippingAddress()->getPostcode();
    return $postCode;

But in the logged out case, not getting the zip code in the payment step. When I refresh the page, it displays.

Please help.

  • You can try using javascript functions to set the payment method area zip code. Use the javascript function to get the zip code field value from shipping area html and assign this value to the payment method area, zip code html element.
    – MGento
    Commented Feb 18, 2019 at 5:41
  • @MGento I want to get it in my config provider
    – Vindhuja
    Commented Feb 18, 2019 at 6:18

1 Answer 1


jQuery Solution

$( "button[data-role='opc-continue']" ).on( "click", function() {


  • I want to get the value in my config provider.
    – Vindhuja
    Commented Feb 18, 2019 at 5:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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