If the Region/State field is not showing on the address in the checkout page of your Magento 2 store, it is likely due to configuration issues or customizations. Here are some steps to troubleshoot and resolve the problem:
Stores
> Configuration
.General
, select General
again.System
> Cache Management
) if necessary.Stores
> Configuration
.Sales
, select Checkout
.when I add a new Address in checkout page, it doesn’t show the Region/State field, but just the city.I don’t know why this is happening, also if I try to checkout with that second address, I got this error Please specify a regionId in shipping address.
So I’m trying to solve these issues.
Here’s a step-by-step guide to achieving this.please follow below steps:
/** * Save new shipping address */ saveNewAddress: function () { var addressData, newShippingAddress; this.source.set('params.invalid', false); this.triggerShippingDataValidateEvent(); if (!this.source.get('params.invalid')) { addressData = this.source.get('shippingAddress'); // if user clicked the checkbox, its value is true or false. Need to convert. addressData['save_in_address_book'] = this.saveInAddressBook ? 1 : 0; if(addressData['region_id'] && $('[name="region_id"]').attr("aria-required")){ addressData['region'] = $('[name="region_id"]').find("option:selected").attr("data-title"); }else{ addressData['region'] = $('[name="region"]').val(); } // New address must be selected as a shipping address newShippingAddress = createShippingAddress(addressData); selectShippingAddress(newShippingAddress); checkoutData.setSelectedShippingAddress(newShippingAddress.getKey()); checkoutData.setNewCustomerShippingAddress($.extend(true, {}, addressData)); this.getPopUp().closeModal(); this.isNewAddressAdded(true); } },
By following these steps, you should be able to identify and resolve the issue with the Region/State field not showing on the address in the checkout page of your Magento 2 store.
Now execute the below command and go to the system configuration page:
php bin/magento s:up
php bin/magento s:d:c
php bin/magento s:s:d -f
php bin/magento c:c
I Hope, This instruction will be helpful for you.
If you have any difficulties regarding this blog, do consider posting them in the Comments section below!
I’m here to help.
Thank you!