Magento 2: Add quantity 2 when add to cart from product view page Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?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

Why did the IBM 650 use bi-quinary?

What do you call a plan that's an alternative plan in case your initial plan fails?

Can a non-EU citizen traveling with me come with me through the EU passport line?

What would be the ideal power source for a cybernetic eye?

When to stop saving and start investing?

Single word antonym of "flightless"

How to find all the available tools in macOS terminal?

Why was the term "discrete" used in discrete logarithm?

Why are there no cargo aircraft with "flying wing" design?

When -s is used with third person singular. What's its use in this context?

What are the pros and cons of Aerospike nosecones?

Should gear shift center itself while in neutral?

G-Code for resetting to 100% speed

Gastric acid as a weapon

The logistics of corpse disposal

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

How to recreate this effect in Photoshop?

How to draw this diagram using TikZ package?

How much radiation do nuclear physics experiments expose researchers to nowadays?

How does cp -a work

Are my PIs rude or am I just being too sensitive?

Storing hydrofluoric acid before the invention of plastics

Letter Boxed validator

Models of set theory where not every set can be linearly ordered



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



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?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
























  • 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
























  • 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



















  • 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

                      Sum ergo cogito? 1 nng

                      三茅街道4182Guuntc Dn precexpngmageondP