How to get all Regions of Country by country code in magento 2?

In Magento 2 we can get all the regions list by country code. We can get all the regions of the specific country by Country code.

Magento\Directory\Model\Country is used to getting all the regions list by the country code. Continue reading “How to get all Regions of Country by country code in magento 2?”

Get Customer Custom attribute value in Magento 2.

We can get custom attribute value of Customer in magento 2 by simple way. If we have created any customer attribute in Magento 2 and we need to get that value in any place in code you can just get custom attribute value by below way,

Let’s we consider Mobile attribute value is custom attribute value created for Customer, attribute code for Mobile is mobile.

You can get customer custom_attribute value by,

$customer = $CUSTOMER_OBJECT; // GET customer object
$customer->getCustomAttribute('mobile')->getValue();

return will be your customer custom_attribute mobile value.

How to disable Company field from Checkout page in Magento 2?

You can disable Company field from Checkout page using Magento 2. Company field came with Native Magento in the checkout page.

Sometimes the client doesn’t want to display extra field like company name, fax or any other unnecessary field from the checkout page.

In Magento 2 You can disable extra field like Company using XML file or by creating a plugin. Continue reading “How to disable Company field from Checkout page in Magento 2?”