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;
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
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.
add a comment |
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
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
add a comment |
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
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
magento2 product addtocart
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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.
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
add a comment |
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"
add a comment |
Hello it happen with me.
Solution for that:addtocart intilize two times on page so find out and remove it
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%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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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"
add a comment |
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"
add a comment |
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"
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"
answered Oct 17 '17 at 15:41
Slava YurthevSlava Yurthev
628
628
add a comment |
add a comment |
Hello it happen with me.
Solution for that:addtocart intilize two times on page so find out and remove it
add a comment |
Hello it happen with me.
Solution for that:addtocart intilize two times on page so find out and remove it
add a comment |
Hello it happen with me.
Solution for that:addtocart intilize two times on page so find out and remove it
Hello it happen with me.
Solution for that:addtocart intilize two times on page so find out and remove it
answered Nov 23 '17 at 17:10
Sunil PatelSunil Patel
1,3781612
1,3781612
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%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
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
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