How to remove zip postal code and country from checkout form?
-
13-12-2019 - |
Question
I want to remove zip/postal code and country from checkout page.
I removed them from billing.phtml file successfully. But when submit checkout data it shows alert that "country" and "zip/postal" code required.
I want to remove them from shipping.phtml file also.
Solution
- Go to Configuration -> General -> Country Options
- Select only a single country (your default country)
- Select all country for the field
Postal Code is Optional for the following countries
. - Update
eav_attribute
table and setis_required = 0
ifattribute_code = 'postcode'
- You can remove the
Zip/Postal Code
fields on templates. Replace
Country
fields with this:<input type="hidden" name="country_id" value="<?php echo Mage::getStoreConfig('general/country/default'); ?>"/> <!-- Original Country Field <div class="field"> <label for="billing:country_id" class="required"><em>*</em><?php /*echo $this->__('Country') */?></label> <div class="input-box"> <?php /*echo $this->getCountryHtmlSelect('billing') */?> </div> </div> -->
OTHER TIPS
For country option just put a style on it as display:none
;
E.g. Note: This option is valid if you have selected by default country option from admin.
<div class="field" style="display:none;">
<label for="billing:country_id" class="required"><em>*</em>
<?php echo $this->__('Country') ?></label>
<div class="input-box">
<?php echo $this->getCountryHtmlSelect('billing') ?>
</div>
</div>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange