10
votes
Accepted
Limit country drop down input field Magento 2
Please allow only that need from Admin > Stores > Configuration > General >
Country Options > Allow Countries
10
votes
Accepted
Remove country form payment block
Not 100% sure about this one, but I think the address in the dropdown is formatted via an admin settings.
You can go to Stores->Configuration->Customer->Customer Configuration->Address ...
8
votes
Accepted
magento 2 : Get country from IP address
Use below code:
protected $logger;
protected $objectManager;
protected $_curl;
public function __construct(
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\...
6
votes
How to get selected Allowed country list in Magento 2..?
You can fetch the Allowed Countries List using the below Code:
public function __construct(
/* Add below dependencies */
\Magento\Directory\Model\AllowedCountries $allowedCountryModel
) {
...
5
votes
Accepted
How to get country dial code for telephone number in Magento 2?
You can create function in helper by enter all dial number with country code. I have created function like below:
public function getphonecode($code)
{
$countrycode = array(
'AD'=>'376'...
5
votes
Accepted
Magento 2 Country Name not get translated when using countryFactory
Use locale code as param in getName
<?php
public function __construct(
\Magento\Directory\Model\CountryFactory $countryFactory
) {
$this->countryFactory = $countryFactory;
}
public ...
4
votes
Change country name in magento 2.2
The country labels loaded using ICU. You can find more info in the Magento\Framework\Locale\Bundle\DataBundle class. Data is loading in the get method:
/**
* Get resource bundle for the locale
*
* ...
3
votes
Accepted
Magento 2.3.3: Creating customer address in admin shows no countries or wrong countries in dropdown
There is a bug in magento 2.3.3. You need to edit admin layout
More information here.
2
votes
How to remove countries from Magento 2 drop down list?
You can achieve this from admin panel. There is no need of writing any code.
Go to Admin Panel :
Stores->Configuration->Sales->tax->Default Tax Destination Calculation.
There you can select ...
2
votes
How to get selected Allowed country list in Magento 2..?
You can utilise the getCountryCollection method in Magento's Directory Helper as it filters the returned collection to contain allowed countries only.
Example:
use Magento\Directory\Helper\Data as ...
2
votes
Magento 2: How to change country name?
Because of the changes in 2.4 being applied in the core translation file app/code/Magento/Config/i18n/en_US.csv We can override it at the theme level. Create a custom translation CSV file here app/...
2
votes
Accepted
sql query for shipping countries from my sales order
From this query you can get countries of shipped orders
SELECT o.increment_id, oa.country_id FROM sales_order o
INNER JOIN sales_order_address oa ON o.entity_id=oa.parent_id
INNER JOIN sales_shipment ...
1
vote
Magento 2 Country Restriction on checkout page shipping address
app/code/Vendor/Checkout/Plugin/Block/DirectoryDataProcessor
Override DirectoryDataProcessor to add a new directory for the shipping step country_id component:
<?php
namespace Vendor\Checkout\...
1
vote
Accepted
Magento2: How to get country list in custom HTML template
With reference to this answer.
Magento already provide some inbuilt solution for this.
<?php $countryBlock = $block->getLayout()->createBlock('Magento\Directory\Block\Data');?>
<?= $...
1
vote
Accepted
Magento 2 Allowed Countries Admin Issue
Please open the below path file.
vendor/magento/module-customer/view/adminhtml/ui_component
open customer_address_form.xml and remove below code from line number.194
<formElements&...
1
vote
Accepted
SOLVED: Tax zones limitation -> Puerto Rico
Do not use "PR" country code: it is no longer legit since USA annexed it in the late 2017.
Community wiki
1
vote
Magento2 VAT id required for specific countries
This can be enabled via admin panel:
Stores > Configuration > Customer Configuration > Name and Address Options > Show Tax/VAT Number
The possible options are:
No
Optional
Required
On ...
1
vote
Limit country drop down input field Magento 2
You can set country drop down option from
Admin >> Store >> Configuration >> General >> General >> Country
Options.
Default Country : Selected country will display as default country in drop ...
1
vote
Accepted
Get customer billing address country short code (ISO Code)
You can try this:
$session = Mage::getSingleton('customer/session');
if ($session->isLoggedIn()) {
$countryCode = $session->getCustomer()->getDefaultBillingAddress()->getCountry();
}
1
vote
Convert the currency format to USD for the purchases outside India
You can do this by doing some customization in index.php file you can set default currency before Mage::run() for that you have to add this code before Mage::run($mageRunCode, $mageRunType);
$...
1
vote
Restrict Place Order if Shipping Country is USA
Check this article:
http://inchoo.net/magento/sorry-we-cant-ship-there/
Also there is some paid modules, that offer this functionality.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
countries × 65magento2 × 20
magento-1.9 × 15
shipping × 10
checkout × 8
country-regions × 7
magento-2.1 × 4
magento-1.7 × 4
shipping-address × 4
currency × 4
billing-address × 4
magento2.3 × 3
shipping-methods × 3
configuration × 3
customer-address × 3
magento-1.8 × 2
admin × 2
magento2.2 × 2
orders × 2
cart × 2
onepage-checkout × 2
store-view × 2
magento2.3.3 × 2
multicurrency × 2
drop-downs × 2