How to remove city as a required field at checkout page in magento 1.9.3.6?
I want to remove required field from city and make it non required field at checkout page. how can i implement this?
magento-1.9 database ce-1.9.0.1 ce-1.9.1.0 magento1.9.3
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I want to remove required field from city and make it non required field at checkout page. how can i implement this?
magento-1.9 database ce-1.9.0.1 ce-1.9.1.0 magento1.9.3
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Why would "city" not be required? Isnt it a very useful field for invoice, shipping... Its part of the address, is there really a usecase where one have no city?
– roman204
Oct 14 '17 at 6:11
@roman204 - there is some error in city field, city value does not save in customer address, it show error when place order again - city is a required field.
– Aks
Oct 14 '17 at 6:40
add a comment |
I want to remove required field from city and make it non required field at checkout page. how can i implement this?
magento-1.9 database ce-1.9.0.1 ce-1.9.1.0 magento1.9.3
I want to remove required field from city and make it non required field at checkout page. how can i implement this?
magento-1.9 database ce-1.9.0.1 ce-1.9.1.0 magento1.9.3
magento-1.9 database ce-1.9.0.1 ce-1.9.1.0 magento1.9.3
asked Oct 14 '17 at 5:42
AksAks
5313
5313
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Why would "city" not be required? Isnt it a very useful field for invoice, shipping... Its part of the address, is there really a usecase where one have no city?
– roman204
Oct 14 '17 at 6:11
@roman204 - there is some error in city field, city value does not save in customer address, it show error when place order again - city is a required field.
– Aks
Oct 14 '17 at 6:40
add a comment |
Why would "city" not be required? Isnt it a very useful field for invoice, shipping... Its part of the address, is there really a usecase where one have no city?
– roman204
Oct 14 '17 at 6:11
@roman204 - there is some error in city field, city value does not save in customer address, it show error when place order again - city is a required field.
– Aks
Oct 14 '17 at 6:40
Why would "city" not be required? Isnt it a very useful field for invoice, shipping... Its part of the address, is there really a usecase where one have no city?
– roman204
Oct 14 '17 at 6:11
Why would "city" not be required? Isnt it a very useful field for invoice, shipping... Its part of the address, is there really a usecase where one have no city?
– roman204
Oct 14 '17 at 6:11
@roman204 - there is some error in city field, city value does not save in customer address, it show error when place order again - city is a required field.
– Aks
Oct 14 '17 at 6:40
@roman204 - there is some error in city field, city value does not save in customer address, it show error when place order again - city is a required field.
– Aks
Oct 14 '17 at 6:40
add a comment |
2 Answers
2
active
oldest
votes
You can remove city
as a required field from checkout page by customizing template file of billing & shipping address form.
In rwd
theme of default Magento 1.9.3.6 you can customize below code in both template files.
For Billing Address form: app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml
Replace below code
<div class="field">
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
</div>
</div>
with
<div class="field">
<label for="billing:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="billing:city" />
</div>
</div>
For Shipping Address form: app/design/frontend/rwd/default/template/checkout/onepage/shipping.phtml
Replace below code
<div class="field">
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
with
<div class="field">
<label for="shipping:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
I hope this will useful to you.
Thanks
add a comment |
1- Remove the required class from following files in your theme folder.
checkout/onepage/shipping.phtml
checkout/onepage/billing.phtml
persistent/checkout/onepage/billing.phtml
<!--<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('city') ?></label>-->
<label for="shipping:city"><?php echo $this->__('city') ?></label>
also remove classes from input field as-well
<?php //echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>
2- copy this core class to your local and remove following lines
app/code/core/Mage/Customer/Model/Address/Abstract.php
/*if (!Zend_Validate::is($this->getcity(), 'NotEmpty')) {
$this->addError(Mage::helper('customer')->__('Please enter the city number.'));
}*/
3- Change the attribute is_required in DB
update eav_attribute set is_required=0 where attribute_code='city';
Note: step three is a dirty hack, correct way would be creating an setup file in your custom extension.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f197225%2fhow-to-remove-city-as-a-required-field-at-checkout-page-in-magento-1-9-3-6%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can remove city
as a required field from checkout page by customizing template file of billing & shipping address form.
In rwd
theme of default Magento 1.9.3.6 you can customize below code in both template files.
For Billing Address form: app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml
Replace below code
<div class="field">
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
</div>
</div>
with
<div class="field">
<label for="billing:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="billing:city" />
</div>
</div>
For Shipping Address form: app/design/frontend/rwd/default/template/checkout/onepage/shipping.phtml
Replace below code
<div class="field">
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
with
<div class="field">
<label for="shipping:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
I hope this will useful to you.
Thanks
add a comment |
You can remove city
as a required field from checkout page by customizing template file of billing & shipping address form.
In rwd
theme of default Magento 1.9.3.6 you can customize below code in both template files.
For Billing Address form: app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml
Replace below code
<div class="field">
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
</div>
</div>
with
<div class="field">
<label for="billing:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="billing:city" />
</div>
</div>
For Shipping Address form: app/design/frontend/rwd/default/template/checkout/onepage/shipping.phtml
Replace below code
<div class="field">
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
with
<div class="field">
<label for="shipping:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
I hope this will useful to you.
Thanks
add a comment |
You can remove city
as a required field from checkout page by customizing template file of billing & shipping address form.
In rwd
theme of default Magento 1.9.3.6 you can customize below code in both template files.
For Billing Address form: app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml
Replace below code
<div class="field">
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
</div>
</div>
with
<div class="field">
<label for="billing:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="billing:city" />
</div>
</div>
For Shipping Address form: app/design/frontend/rwd/default/template/checkout/onepage/shipping.phtml
Replace below code
<div class="field">
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
with
<div class="field">
<label for="shipping:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
I hope this will useful to you.
Thanks
You can remove city
as a required field from checkout page by customizing template file of billing & shipping address form.
In rwd
theme of default Magento 1.9.3.6 you can customize below code in both template files.
For Billing Address form: app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml
Replace below code
<div class="field">
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
</div>
</div>
with
<div class="field">
<label for="billing:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="billing:city" />
</div>
</div>
For Shipping Address form: app/design/frontend/rwd/default/template/checkout/onepage/shipping.phtml
Replace below code
<div class="field">
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
with
<div class="field">
<label for="shipping:city"><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
I hope this will useful to you.
Thanks
answered Oct 14 '17 at 6:47
user48180
add a comment |
add a comment |
1- Remove the required class from following files in your theme folder.
checkout/onepage/shipping.phtml
checkout/onepage/billing.phtml
persistent/checkout/onepage/billing.phtml
<!--<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('city') ?></label>-->
<label for="shipping:city"><?php echo $this->__('city') ?></label>
also remove classes from input field as-well
<?php //echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>
2- copy this core class to your local and remove following lines
app/code/core/Mage/Customer/Model/Address/Abstract.php
/*if (!Zend_Validate::is($this->getcity(), 'NotEmpty')) {
$this->addError(Mage::helper('customer')->__('Please enter the city number.'));
}*/
3- Change the attribute is_required in DB
update eav_attribute set is_required=0 where attribute_code='city';
Note: step three is a dirty hack, correct way would be creating an setup file in your custom extension.
add a comment |
1- Remove the required class from following files in your theme folder.
checkout/onepage/shipping.phtml
checkout/onepage/billing.phtml
persistent/checkout/onepage/billing.phtml
<!--<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('city') ?></label>-->
<label for="shipping:city"><?php echo $this->__('city') ?></label>
also remove classes from input field as-well
<?php //echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>
2- copy this core class to your local and remove following lines
app/code/core/Mage/Customer/Model/Address/Abstract.php
/*if (!Zend_Validate::is($this->getcity(), 'NotEmpty')) {
$this->addError(Mage::helper('customer')->__('Please enter the city number.'));
}*/
3- Change the attribute is_required in DB
update eav_attribute set is_required=0 where attribute_code='city';
Note: step three is a dirty hack, correct way would be creating an setup file in your custom extension.
add a comment |
1- Remove the required class from following files in your theme folder.
checkout/onepage/shipping.phtml
checkout/onepage/billing.phtml
persistent/checkout/onepage/billing.phtml
<!--<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('city') ?></label>-->
<label for="shipping:city"><?php echo $this->__('city') ?></label>
also remove classes from input field as-well
<?php //echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>
2- copy this core class to your local and remove following lines
app/code/core/Mage/Customer/Model/Address/Abstract.php
/*if (!Zend_Validate::is($this->getcity(), 'NotEmpty')) {
$this->addError(Mage::helper('customer')->__('Please enter the city number.'));
}*/
3- Change the attribute is_required in DB
update eav_attribute set is_required=0 where attribute_code='city';
Note: step three is a dirty hack, correct way would be creating an setup file in your custom extension.
1- Remove the required class from following files in your theme folder.
checkout/onepage/shipping.phtml
checkout/onepage/billing.phtml
persistent/checkout/onepage/billing.phtml
<!--<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('city') ?></label>-->
<label for="shipping:city"><?php echo $this->__('city') ?></label>
also remove classes from input field as-well
<?php //echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>
2- copy this core class to your local and remove following lines
app/code/core/Mage/Customer/Model/Address/Abstract.php
/*if (!Zend_Validate::is($this->getcity(), 'NotEmpty')) {
$this->addError(Mage::helper('customer')->__('Please enter the city number.'));
}*/
3- Change the attribute is_required in DB
update eav_attribute set is_required=0 where attribute_code='city';
Note: step three is a dirty hack, correct way would be creating an setup file in your custom extension.
answered Feb 12 '18 at 5:06
nanbatmannanbatman
1363
1363
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f197225%2fhow-to-remove-city-as-a-required-field-at-checkout-page-in-magento-1-9-3-6%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why would "city" not be required? Isnt it a very useful field for invoice, shipping... Its part of the address, is there really a usecase where one have no city?
– roman204
Oct 14 '17 at 6:11
@roman204 - there is some error in city field, city value does not save in customer address, it show error when place order again - city is a required field.
– Aks
Oct 14 '17 at 6:40