Magento 2: Add quantity 2 when add to cart from product view page The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)display the quantity box in product view pageQuantity in checkout shopping cart doesn't work properly for MagentoDifferent quantity for different size add to cart productAdd to cart button added the same product issueMagento 2: Add multiple products to cart programmaticallyadding and removing product from the cart at the same timeMagento 2 - Quantity in cartAdd to cart only stock availabel quantity Magento ShopMagento 2: Observer add product to cart?Magento 2 how to add products into cart without loading page

Keeping a retro style to sci-fi spaceships?

How is simplicity better than precision and clarity in prose?

Do working physicists consider Newtonian mechanics to be "falsified"?

Python - Fishing Simulator

The variadic template constructor of my class cannot modify my class members, why is that so?

How many people can fit inside Mordenkainen's Magnificent Mansion?

Why is superheterodyning better than direct conversion?

Why can't wing-mounted spoilers be used to steepen approaches?

Is every episode of "Where are my Pants?" identical?

Create an outline of font

How to copy the contents of all files with a certain name into a new file?

How should I replace vector<uint8_t>::const_iterator in an API?

Was credit for the black hole image misattributed?

Typeface like Times New Roman but with "tied" percent sign

Who or what is the being for whom Being is a question for Heidegger?

First use of “packing” as in carrying a gun

He got a vote 80% that of Emmanuel Macron’s

Are spiders unable to hurt humans, especially very small spiders?

Simulating Exploding Dice

Problems with Ubuntu mount /tmp

Semisimplicity of the category of coherent sheaves?

Is this wall load bearing? Blueprints and photos attached

system() function string length limit

When did F become S in typeography, and why?



Magento 2: Add quantity 2 when add to cart from product view page



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)display the quantity box in product view pageQuantity in checkout shopping cart doesn't work properly for MagentoDifferent quantity for different size add to cart productAdd to cart button added the same product issueMagento 2: Add multiple products to cart programmaticallyadding and removing product from the cart at the same timeMagento 2 - Quantity in cartAdd to cart only stock availabel quantity Magento ShopMagento 2: Observer add product to cart?Magento 2 how to add products into cart without loading page



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Add quantity 2 when adding to cart from product view page.



For only one product because it calls 2-time post request for one product.



After clearing cache and checking and some time that works, but again that problem comes in other product.










share|improve this question
















bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Have you customize anything or extended any js ?

    – Codrain Technolabs Pvt Ltd
    Apr 22 '16 at 11:39











  • have you got this answer @user15917

    – Devidas
    Oct 27 '18 at 7:23

















0















Add quantity 2 when adding to cart from product view page.



For only one product because it calls 2-time post request for one product.



After clearing cache and checking and some time that works, but again that problem comes in other product.










share|improve this question
















bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Have you customize anything or extended any js ?

    – Codrain Technolabs Pvt Ltd
    Apr 22 '16 at 11:39











  • have you got this answer @user15917

    – Devidas
    Oct 27 '18 at 7:23













0












0








0








Add quantity 2 when adding to cart from product view page.



For only one product because it calls 2-time post request for one product.



After clearing cache and checking and some time that works, but again that problem comes in other product.










share|improve this question
















Add quantity 2 when adding to cart from product view page.



For only one product because it calls 2-time post request for one product.



After clearing cache and checking and some time that works, but again that problem comes in other product.







magento2 product addtocart






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 27 '17 at 13:32









Amrit Pal Singh

802623




802623










asked Apr 22 '16 at 11:34







user15917












bumped to the homepage by Community 2 days 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 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Have you customize anything or extended any js ?

    – Codrain Technolabs Pvt Ltd
    Apr 22 '16 at 11:39











  • have you got this answer @user15917

    – Devidas
    Oct 27 '18 at 7:23

















  • Have you customize anything or extended any js ?

    – Codrain Technolabs Pvt Ltd
    Apr 22 '16 at 11:39











  • have you got this answer @user15917

    – Devidas
    Oct 27 '18 at 7:23
















Have you customize anything or extended any js ?

– Codrain Technolabs Pvt Ltd
Apr 22 '16 at 11:39





Have you customize anything or extended any js ?

– Codrain Technolabs Pvt Ltd
Apr 22 '16 at 11:39













have you got this answer @user15917

– Devidas
Oct 27 '18 at 7:23





have you got this answer @user15917

– Devidas
Oct 27 '18 at 7:23










3 Answers
3






active

oldest

votes


















0














The MagentoCheckoutControllerCartAdd::execute() method has support for the qty request param. Try adding a new hidden input named qty and value of 2 in the add-to-cart form template file.



Maybe there's a more elegant way of doing this, but I don't know about it yet.






share|improve this answer


















  • 1





    I have added this code: <script type="text/x-magento-init"> "#product_addtocart_form": "Magento_Catalog/product/view/validation": "radioCheckboxClosest": ".nested" , "catalogAddToCart": "addToCartButtonTextDefault": "<?php echo __('Add to Cart'); ?>", "addToCartButtonTextWhileAdding": "<?php echo __('Adding...'); ?>", "addToCartButtonTextAdded": "<?php echo __('Added'); ?>" </script> in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

    – user15917
    Apr 26 '16 at 11:50



















0














from addtocart.phtml



<input type="number" 
name="qty"
id="qty"
maxlength="12"
value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>"
title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
class="input-text qty" data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" />


change value to "2"






share|improve this answer






























    0














    Hello it happen with me.



    Solution for that:addtocart intilize two times on page so find out and remove it






    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%2f112156%2fmagento-2-add-quantity-2-when-add-to-cart-from-product-view-page%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown
























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      The MagentoCheckoutControllerCartAdd::execute() method has support for the qty request param. Try adding a new hidden input named qty and value of 2 in the add-to-cart form template file.



      Maybe there's a more elegant way of doing this, but I don't know about it yet.






      share|improve this answer


















      • 1





        I have added this code: <script type="text/x-magento-init"> "#product_addtocart_form": "Magento_Catalog/product/view/validation": "radioCheckboxClosest": ".nested" , "catalogAddToCart": "addToCartButtonTextDefault": "<?php echo __('Add to Cart'); ?>", "addToCartButtonTextWhileAdding": "<?php echo __('Adding...'); ?>", "addToCartButtonTextAdded": "<?php echo __('Added'); ?>" </script> in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

        – user15917
        Apr 26 '16 at 11:50
















      0














      The MagentoCheckoutControllerCartAdd::execute() method has support for the qty request param. Try adding a new hidden input named qty and value of 2 in the add-to-cart form template file.



      Maybe there's a more elegant way of doing this, but I don't know about it yet.






      share|improve this answer


















      • 1





        I have added this code: <script type="text/x-magento-init"> "#product_addtocart_form": "Magento_Catalog/product/view/validation": "radioCheckboxClosest": ".nested" , "catalogAddToCart": "addToCartButtonTextDefault": "<?php echo __('Add to Cart'); ?>", "addToCartButtonTextWhileAdding": "<?php echo __('Adding...'); ?>", "addToCartButtonTextAdded": "<?php echo __('Added'); ?>" </script> in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

        – user15917
        Apr 26 '16 at 11:50














      0












      0








      0







      The MagentoCheckoutControllerCartAdd::execute() method has support for the qty request param. Try adding a new hidden input named qty and value of 2 in the add-to-cart form template file.



      Maybe there's a more elegant way of doing this, but I don't know about it yet.






      share|improve this answer













      The MagentoCheckoutControllerCartAdd::execute() method has support for the qty request param. Try adding a new hidden input named qty and value of 2 in the add-to-cart form template file.



      Maybe there's a more elegant way of doing this, but I don't know about it yet.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Apr 24 '16 at 10:25









      nevvermindnevvermind

      1,3101118




      1,3101118







      • 1





        I have added this code: <script type="text/x-magento-init"> "#product_addtocart_form": "Magento_Catalog/product/view/validation": "radioCheckboxClosest": ".nested" , "catalogAddToCart": "addToCartButtonTextDefault": "<?php echo __('Add to Cart'); ?>", "addToCartButtonTextWhileAdding": "<?php echo __('Adding...'); ?>", "addToCartButtonTextAdded": "<?php echo __('Added'); ?>" </script> in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

        – user15917
        Apr 26 '16 at 11:50













      • 1





        I have added this code: <script type="text/x-magento-init"> "#product_addtocart_form": "Magento_Catalog/product/view/validation": "radioCheckboxClosest": ".nested" , "catalogAddToCart": "addToCartButtonTextDefault": "<?php echo __('Add to Cart'); ?>", "addToCartButtonTextWhileAdding": "<?php echo __('Adding...'); ?>", "addToCartButtonTextAdded": "<?php echo __('Added'); ?>" </script> in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

        – user15917
        Apr 26 '16 at 11:50








      1




      1





      I have added this code: <script type="text/x-magento-init"> "#product_addtocart_form": "Magento_Catalog/product/view/validation": "radioCheckboxClosest": ".nested" , "catalogAddToCart": "addToCartButtonTextDefault": "<?php echo __('Add to Cart'); ?>", "addToCartButtonTextWhileAdding": "<?php echo __('Adding...'); ?>", "addToCartButtonTextAdded": "<?php echo __('Added'); ?>" </script> in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

      – user15917
      Apr 26 '16 at 11:50






      I have added this code: <script type="text/x-magento-init"> "#product_addtocart_form": "Magento_Catalog/product/view/validation": "radioCheckboxClosest": ".nested" , "catalogAddToCart": "addToCartButtonTextDefault": "<?php echo __('Add to Cart'); ?>", "addToCartButtonTextWhileAdding": "<?php echo __('Adding...'); ?>", "addToCartButtonTextAdded": "<?php echo __('Added'); ?>" </script> in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

      – user15917
      Apr 26 '16 at 11:50














      0














      from addtocart.phtml



      <input type="number" 
      name="qty"
      id="qty"
      maxlength="12"
      value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>"
      title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
      class="input-text qty" data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" />


      change value to "2"






      share|improve this answer



























        0














        from addtocart.phtml



        <input type="number" 
        name="qty"
        id="qty"
        maxlength="12"
        value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>"
        title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
        class="input-text qty" data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" />


        change value to "2"






        share|improve this answer

























          0












          0








          0







          from addtocart.phtml



          <input type="number" 
          name="qty"
          id="qty"
          maxlength="12"
          value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>"
          title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
          class="input-text qty" data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" />


          change value to "2"






          share|improve this answer













          from addtocart.phtml



          <input type="number" 
          name="qty"
          id="qty"
          maxlength="12"
          value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>"
          title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
          class="input-text qty" data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" />


          change value to "2"







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 17 '17 at 15:41









          Slava YurthevSlava Yurthev

          628




          628





















              0














              Hello it happen with me.



              Solution for that:addtocart intilize two times on page so find out and remove it






              share|improve this answer



























                0














                Hello it happen with me.



                Solution for that:addtocart intilize two times on page so find out and remove it






                share|improve this answer

























                  0












                  0








                  0







                  Hello it happen with me.



                  Solution for that:addtocart intilize two times on page so find out and remove it






                  share|improve this answer













                  Hello it happen with me.



                  Solution for that:addtocart intilize two times on page so find out and remove it







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 23 '17 at 17:10









                  Sunil PatelSunil Patel

                  1,3781612




                  1,3781612



























                      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%2f112156%2fmagento-2-add-quantity-2-when-add-to-cart-from-product-view-page%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

                      Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

                      Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

                      Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림