How to remove city as a required field at checkout page in magento 1.9.3.6? The Next CEO of...

Is the D&D universe the same as the Forgotten Realms universe?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Does Germany produce more waste than the US?

What was the first Unix version to run on a microcomputer?

Is there a difference between "Fahrstuhl" and "Aufzug"

Dominated convergence theorem - what sequence?

How did people program for Consoles with multiple CPUs?

What does "Its cash flow is deeply negative" mean?

Can MTA send mail via a relay without being told so?

Is micro rebar a better way to reinforce concrete than rebar?

Should I tutor a student who I know has cheated on their homework?

What steps are necessary to read a Modern SSD in Medieval Europe?

Prepend last line of stdin to entire stdin

Bartok - Syncopation (1): Meaning of notes in between Grand Staff

Which one is the true statement?

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

Axiom Schema vs Axiom

How do I align (1) and (2)?

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?

Is French Guiana a (hard) EU border?

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Is it professional to write unrelated content in an almost-empty email?

How to get from Geneva Airport to Metabief, Doubs, France by public transport?



How to remove city as a required field at checkout page in magento 1.9.3.6?



The Next CEO of Stack OverflowHow to add city (not state!) in magento?How to make address fields not required in checkout?Add default value to City field in Billing and ShippingRemove required validation from address checkout - Magento 1.9Remove validation from city field in checkoutHow to remove Company and Fax field from onepage checkoutE-mail field not required on checkouthow to remove zip , fax , company field from checkoutdropdown city in checkout magento1.9












0















I want to remove required field from city and make it non required field at checkout page. how can i implement this?



enter image description here










share|improve this question














bumped to the homepage by Community 9 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
















0















I want to remove required field from city and make it non required field at checkout page. how can i implement this?



enter image description here










share|improve this question














bumped to the homepage by Community 9 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














0












0








0








I want to remove required field from city and make it non required field at checkout page. how can i implement this?



enter image description here










share|improve this question














I want to remove required field from city and make it non required field at checkout page. how can i implement this?



enter image description here







magento-1.9 database ce-1.9.0.1 ce-1.9.1.0 magento1.9.3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 14 '17 at 5:42









AksAks

5313




5313





bumped to the homepage by Community 9 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 9 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



















  • 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










2 Answers
2






active

oldest

votes


















0














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






share|improve this answer































    0














    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.






    share|improve this answer
























      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
      });


      }
      });














      draft saved

      draft discarded


















      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









      0














      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






      share|improve this answer




























        0














        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






        share|improve this answer


























          0












          0








          0







          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






          share|improve this answer













          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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 14 '17 at 6:47







          user48180
































              0














              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.






              share|improve this answer




























                0














                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.






                share|improve this answer


























                  0












                  0








                  0







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 12 '18 at 5:06









                  nanbatmannanbatman

                  1363




                  1363






























                      draft saved

                      draft discarded




















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                      How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                      夢乃愛華...