Questions tagged [addtocart]
Questions related to the functionality of adding product to shopping cart in Magento.
1,031
questions
0
votes
0answers
9 views
Display custom priduct on category page and allow add to cart
I want to display product's custom option on listing page and want to allow customer to add to cart from the category listing page.
I have added Qty field and following code to display the custom ...
0
votes
0answers
14 views
Product in reservation show like out of stock(MAGENTO2 MSI)
I have stock_qty = 2 and salable_qty=0 because my products reservationed and when I open product page add To Cart is exist. Can this product show like out of stock when salabe qty is 0 ?
0
votes
0answers
16 views
M2.2 | Button that can add multiple individual products to the cart all at once?
In short, we are looking for the ability to have a customizable button (be it through js, small module or whatever) to where we can have a button that would infact add multiple individual products to ...
0
votes
1answer
21 views
Limit Cart Items to Add in Cart
I want to limit cart items to be added in cart.
Limit Checkout Order or Add to Cart Limit to allow only 6 type of items.
These 6 items can have variable Qty value.
I have done the below code using ...
0
votes
1answer
17 views
How to Add Additional Options in Magento 2 and convert it into order?
I need to add my custom detail in cart along with product detail and transfer these details in order too.
I want to use additional option functionality for this.
0
votes
1answer
24 views
Limit Add to Cart Items
I want to Limit Checkout Order or Add to Cart Limit to allow only 6 types of products/items.
These 6 items can have variable Qty value.
Eg:
One Checkout/AddCart Maximum 6 Items:
Item-1 25Qty, Item-2 ...
0
votes
2answers
138 views
Magento 2.4 REST API for Create Cart Not Working
I am trying to create the magento default REST API for add simple product to cart like this way.
First I generate the customer token with the use of this API Call.
https://www.domain.com/rest/default/...
0
votes
1answer
21 views
Magento 2 : API Get Customer Cart Data using customer ID
I am building custom magento 2 API. I want to get customer CART DATA using CUSTOMER_ID.
I have tried following code but its not working.
$params = $this->request->getPostValue();
$customerId = $...
0
votes
1answer
29 views
Add to Cart button not adding in cart Magento 2.3.3
I have setup magento 2.3.3 on server php 7.2.
All buttons working fine on product detail page but Add to Cart button not adding product in cart. Same is working fine on local pc xampp but not working ...
1
vote
1answer
19 views
Magento2 - add Product to cart with out-stock status
Is it possible add product to cart with stock status = out-stock.
I used plugin to override method with afterIsSalable, with this add-cart-button showing but not adding product into cart.
Note: ...
0
votes
2answers
46 views
“Invalid Form Key, please refresh the page? ” - addtocart
I am testing website deployed based on Magenta Template Framework, the problem that occurred is that the cart kept being empty even the add to cart link has been ran. And furthermore, i kept getting ...
0
votes
0answers
9 views
Magento 1.9 - How to display upsells products in popup on add to cart click?
In Magento 1.9, when someone click on add to cart button I need to show a popup with upsells products.
I don't how to achieve this, can you help me ?
Thanks
0
votes
0answers
9 views
how can i add to cart group and bundle products in magento 2 programmatically
for a single product, I am using
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$quote = $objectManager->create('Magento\Checkout\Model\Cart');
$params['qty'] = 2;
$quote->...
0
votes
0answers
24 views
Magento 2 LocalStorageCart
I want to manipulate localstorage and add or remove items from cart, the problem is with backend everything works from the frontend but when i go to the checkout page i see all the items that i ...
0
votes
0answers
25 views
How to add multiple products to cart using ajax in magento 2
I want to add more products to cart using ajax in magento 2 but it doesn't work. please help me to solve this problem here's my code
file ajax.phtml
<script>
require(['jquery'], function($){
...
0
votes
0answers
44 views
How to Add to cart all product in magento 2
I added a button ("Add all product") on the header. How can I add all products to the cart by clicking on. Someone can help me to solve this problem. Thank you
0
votes
0answers
11 views
Magento 2: After Ajax add to cart redirect to different page
Magento 2, after ajax add to cart, how can I redirect to the custom page.
Need to redirect only for specific product categories if successful product is added to cart.
0
votes
0answers
14 views
I need bundle Product options to display automatically - i.e. without having to click the “customize and add to cart” button
I am upgrading to Magento 2 and they have changed the way that bundles display. With a brand new clean install of M2.4 I am reluctant to start messing about with the code too much. I thought I had ...
0
votes
0answers
7 views
Magento2 Restrict particular category product from adding to cart when other is present
Magento2 I have to add 2 conditions on add to cart
For e.g. There are 3 categories A,B & C
Restrict Category B products to add to cart when category A product is already added & vice verse
...
0
votes
0answers
56 views
How to display cart item count in custom header using JavaScript?
I've created a custom header that works fine. I replaced Magento's cart, and instead added a shopping basket icon in the header. Like so:
When pressed it redirects to the cart.
What I want to do is ...
0
votes
1answer
36 views
Magento2: Bundle Product add to cart without selecting options (Product Item)
I am working on cms page custom product layout for that I have written custom controller. but it show error
{"0":"Please select all required options.","1":"#1
...
0
votes
1answer
14 views
How to Add Product Specification Section Under Product Info in Magento 2?
How to Add Product Specification Section Under Product Info in Magento 2
0
votes
1answer
12 views
Child Theme showing strange labels on breadcrumbs, buttons, labels etc.( {{{Home}}{{Home}}{{Home}}{{themeVendor/ThemeName}}})
I have a problem with my child theme in Magento. On the products page it shows labels like "{{{Home}}{{Home}}{{Home}}{{themeVendor/ThemeName}}}" for the breadcrumbs or "{{{Add to Cart}}{...
0
votes
1answer
17 views
Magento2 display Add to cart success message under Add to cart button on product details page
Magento2 How can I display product Added to cart success message under Add to cart button on product details page?
0
votes
0answers
7 views
When adding simple product in cart getting the customer-data.js
Error: {"message":"The product that was requested doesn't exist. Verify the product and try again."}
When adding the product to the cart getting this what is the purpose ...
0
votes
0answers
31 views
Add ajax qty plus minus buttons in shop page
Hello guys i want to add qty plus and minus in catalog view so when my clients press plus automatically add the item to cart and if the press minus remove the item specific qty from cart. and if they ...
0
votes
0answers
20 views
How to add product from one store to another store in magento2?
I have two store
Store A
-Store B
I have one configurable product SKU-test123.
Now I want to display it to StoreA's one CMS page
for example: www.storeA.com/testcms (using catalog product widget)
...
0
votes
0answers
17 views
Ajax Add to cart in wishlist page magento 2.4
I'm looking for a way to add ajax functionality to the wishlist page. So when I add a product to the cart in my wishlist page it utilizes ajax.
How would I approach this?
Hope for an answer. Thanks in ...
0
votes
1answer
29 views
How to check if a product is salable using isSalable()?
I am trying to use plugin to override Magento\Checkout\Model\Cart.php - addOrderItem function
Instead of getting item's quantity, how to check if product is salable using isSalable()? Is there any way ...
1
vote
0answers
35 views
Replace the QTY of the product in the cart on “add to cart” rather than increment
How to replace the quantity of the product in the cart instead of increment?
Current behaviour:
From the product page:
Add 5 qty of product A
Add 2 qty of product A (add product again)
The cart qty ...
0
votes
0answers
18 views
How to get attributes before adding product to the cart past api / rest?
I've been researching and testing plugins and events for more than 20 days
add the customized item passed by POST /V1/carts/{quoteId}/items.
{
"cartItem": {
"sku": "1809&...
0
votes
0answers
14 views
Hit a curl request at the time of add to cart in magento 2?
I want to hit an external curl request at the time of add to cart click in magento 2.
Based on that result product will be added or not in cart How will i hit curl on add to cart click ?
0
votes
0answers
12 views
Magneto 2: How to add a configurable product with custom options in cart
I am trying to add configurable product with it's custom options. Right now I have a swatch with 2 custom options. Whenever I try to add that product It just add the swatch value. It doesn't add the ...
0
votes
0answers
9 views
How to hit 3rd party API when user click on Add to cart in Magento 2?
I want to hit a 3rd party API when user click on Add to cart in Magento 2 and based on that result i want to add product on cart or show a custom message to user that didn't want to add that product ...
0
votes
2answers
27 views
Magento 2: Prevent add to cart or qty increase if a product already exists in cart
I want a feature where if a customer tries to add a product which already exists in cart then it should prevent it from adding again or qty increase. Instead I want to show a message that 'The product ...
0
votes
0answers
87 views
Magento 2 in iframe add to cart issue
I'm trying to show Magento 2 inside an iframe. Site loading fine but add to cart and login not working when add to cart getting below error
[2020-09-08 08:34:45] main.DEBUG: Request validation failed ...
0
votes
0answers
57 views
magento 2 iframe src code login not wokring
Hi I am facing some issues add to cart and login with iframe. I have created i frame code
<iframe id="Pawan" frameborder="0" align="middle" width="100%" ...
0
votes
0answers
7 views
Magento2.3: Products not Updated in Mini cart
Before page loads completely, click on add to cart button then the product is added to cart but the issue is, it is not updated in minicart.
0
votes
2answers
88 views
how to add product to cart in magento 2 using custom controller?
I have tried the following controller file to add product to cart in my custom extension.
<?php
namespace MS\Recommendeditems\Controller\Index;
class Index extends \Magento\Framework\App\Action\...
1
vote
0answers
23 views
Set minimum order value and enable checkout
I'm setting up a site that sells variable products, priced by area. I need to set a minimum order value to cover production costs.
I can set a minimum order value that does not allow the order to ...
0
votes
1answer
23 views
How to check if configurable options have been chosen before showing a modal?
I have added a new button next to the add-to-cart button:
<button type="button" class="action secondary personalize" data-trigger="personalise">
<span data-...
1
vote
1answer
47 views
Magento 2 disable merge items into the cart
HI I want customer add same item into cart with separate line. I don't want them merge together and into single line. Is there anyway to do this? I saw people asking for Magento 1, is there any ...
1
vote
1answer
26 views
How to add success mesage on click of add to cart buttton in custom module in Magento 2
I want to display success message on click of add to cart button in magento 2.
I am developing custom module in which i can develop functionality of add to cart and i want to add success and error ...
1
vote
0answers
64 views
Magento 2 Remove Add to Cart button and Add New Custom Button
I am creating a module. I have create one custom product attribute which value is YES/NO.
if product attribute value is Yes then Add to Cart Button hide And Show Custom Button
if product attribute ...
0
votes
2answers
330 views
How check qty before add to cart in magento 2?
I need intercept the product qty before add in cart. I see the events list but don't find any observer to make this action. Any idea? Thanks.
0
votes
1answer
59 views
Magento 2.3.2 Add to cart not working even with 127.0.0.1
I have installed fresh Magento 2.3.2, but add to cart is not working even I have changed the secure and unsecure base url in core_config_data table from http://localhost/magento2/ to http://127.0.0.1/...
0
votes
0answers
17 views
The errror message “We don't have as many of some products as you want” is showing while adding the product to cart
I am getting the error message "We don't have as many of some products as you want" while adding the product to cart.
Help me to resolve this.
0
votes
0answers
20 views
Using product options/attributes to add a separate line item during add to cart
This is a bit hard to describe so please bear with me and hopefully it will all make sense.
My basic goal is to have product options/attributes function to add a second, separate line-item to the cart....
0
votes
0answers
17 views
error comming while add to cart using textarea in magento 2.3.5
I am facing this kind of error while creating module for custom add to cart in magento 2.3.5.
So can anyone have idea then please share with me.
Thank you in advance.
0
votes
0answers
21 views
magento 2 product add to cart URL doesnt have a form key
I am trying to get the cart add to cart URL in magento 2 but the URL being returned by the getAddToCartUrl is not valid.
public function __construct(
\Magento\Catalog\Block\Product\ListProduct $...