Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [addtocart]

Questions related to the functionality of adding product to shopping cart in Magento.

0
votes
0answers
15 views

Magento 2 : Add Params using add to cart API

I want to add a custom parameter in add to cart product api billing_period & subscription_start_date. I have tried with Magento's /V1/carts/mine/items API with below request data. { "cartItem"...
0
votes
0answers
16 views

Magento 2 add to cart performance issue

In my Magento 2 website adding to cart takes about 10 sec. Caching is OK. Redis is configured. Merging/minimizing for CSS/JS is enabled. I'm noticed that after first adding an item to the cart, adding ...
0
votes
2answers
28 views

Magento addtocart formkey 404

I've been struggling with this issue for a few hours now and thought to see if anyone else has any ideas on why it could be happening. When I try to add a product to the cart, I get a 404 error with ...
0
votes
1answer
22 views

How to customize Add to cart functionality based on product categories in Magento 2?

I am using Magento 2.3.0 I have some products in my website which allows custom printing and these products are assigned in category "Printing Products". Now I want to customize add to cart ...
3
votes
1answer
64 views

Restrict product add to cart in magento 2

i am using magento 2.1.5, and i have two tax classes. and i want to add only one tax class product in cart at a time. if customer try to add another tax class product, it will throw the massage. for ...
0
votes
0answers
28 views

$_product->isSaleable() shows different value in list page and view page magento 2

Issue: Out of stock set at admin side. On product list page display "Out of stock" while detail page shows "Add to cart" button. I have print the $_product->isSaleable() function on list.phtml as ...
0
votes
0answers
24 views

Magento2.3.1 getting issue when update qty

how to solve this error when trying to update qty in cart? "Something went wrong while saving the page. Please refresh the page and try again."
0
votes
0answers
29 views

Update custom option value of item in cart Magento 2

I have custom option for one of my product. I am able to save it's value in cart programatically using below code: $params = array( 'form_key' => $this->formKey->getFormKey(), ...
0
votes
1answer
25 views

Add Product to cart error: invalid request for adding product to quote

I have a plugin and i want to add a product to the actual cart. This is my code: $productId = 2; $params = array( 'form_key' => $this->formKey->...
0
votes
0answers
21 views

Magento 2.3.1 getting error “Your session has expired” while product added to basket

The strange thing is that this is only happenings on listing pages and not on PDP. I get a 404 on the following js files: pageCache.js addToWishlist.js amazonCore.js I'm running Magento 2.3.1 ...
0
votes
2answers
41 views

Magento 2 add to cart programmatically not working

Here am have a custom api at that API call am trying to add a product to cart but am not getting it. namespace Vendor\Cart\Model; use Magento\Framework\Data\Form\FormKey; use Vendor\Cart\Api\...
0
votes
1answer
11 views

Order “non-existant” product

I have my products repository externally and only use Magento 2 to actually order these items. Similar to this question here but unfortunaly that does not have an answer or specifics about ...
0
votes
0answers
13 views

Replace add to cart button [duplicate]

Hello I find module to replace text in button add to card and this is no working. Please help this is code Magenticians/Mymodule/view/frontend/layout/catalog_product_view.xml <?xml version="1.0"...
0
votes
0answers
19 views

Magento 2 customer is saved as guest even if he logged-in in quote table

We have an issue that if a customer is logged-in and add product to cart, in quote table we have a column as customer_is_guest, it is saving as 1, even if the customer is logged-in, it is showing as ...
0
votes
1answer
29 views

Magento 2 checkout_cart_product_add_after not working

here am trying to add custom price during adding product to cart but checkout_cart_product_add_after event is not getting fired. my API to add to cart is http://localhost/magento/rest/V1/carts/636/...
3
votes
3answers
74 views

How and where to change add to cart message in Magento 2?

I am using Magento 2.3.0 Above message displays when we try to add product more than available quantity from the product detail page. I want to change this error message and want to add a new custom ...
0
votes
1answer
10 views

How can I get all data from cart

Is it possible to get check if cart has any product been added in. I want to check if a product been added to the cart in a phtml page. If the user click the page I want to show how many product they ...
0
votes
0answers
21 views

how to remove add to cart button if price is 0 in magento 1?

I have done for call for price if price 0, But after that i want to remove add to cart button if price is 0. <?php if ($_product->getFinalPrice() == 0) : ?> <?php echo ...
1
vote
0answers
13 views

Magento 1.9 moving products between websites

How to move a product/item who was added to cart/quote on websiteA to cart/quote which is on websiteB. I would like to solve this problem with controller, but I am not very successfull. Do you ...
0
votes
1answer
28 views

Magento 2 - Don't want to remove wishlist items when click 'Add all to cart' button

I want to keep items in wishlist when user click "add all to cart" button. Have any idea how to fix it?
0
votes
1answer
29 views

How to add custom option price when product is adding add to cart using controller

I have to add the custom option price when product is adding add to cart using controller
0
votes
0answers
12 views

Magento 2 - addToCart doesn't calculate price correctly

I am adding a product with custom options to my cart. One of the options costs extra. But the Magento Cart page does not show the price correctly. Here you can see the cart page. The Summary shows ...
1
vote
1answer
26 views

Add existing custom option to cart item if the option was not included initially

I can update existing cart values: $item = $quote->getItemById($itemId); $item->getOptionByCode('option_code')->setValue($value); $item->saveItemOptions(); But this only works if the ...
0
votes
0answers
14 views

Add Free Product to Cart price threshold doesn't work after discount applied

Were using Magento 1.9 CE We offer free gifts with purchase (GWP) when the GWP conditions are met. Most often the threshold is a certain $ amount. We have an issue that when a discount code is ...
0
votes
1answer
36 views

Call to a member function getValue() on null in AbstractType when loading cart

I have a simple product with a configuration option. The SKU of my product is configurator and the SKU of the options is configuration. The configuration option is a string field. To add the product ...
1
vote
0answers
20 views

How to debug checkout_cart_product_add_after event on exit

I am trying to exit point on observer for checkout_cart_product_add_after event. But it always refresh after item added to cart. Any way to print data when debug this event and not refresh the page. ...
0
votes
2answers
36 views

Custom price in cart not working in Magento 2.3.1 observer

I am developing a magento site for furniture sale. I have some grouped products. If a customer add 1 piece of any product of the group to cart, the special price will be added to cart. If the ...
0
votes
2answers
13 views

add item to cart with addition option console error Unable to unserialize value

i am trying to add product to cart with addition option but i ended up with message: "Unable to unserialize value." this error on console resoponse on section refresh. Console I am using ...
5
votes
2answers
252 views

How to set custom tax price during add to cart in Magento 2

I am adding product to cart using ajax call. Here is my controller code. use Magento\Framework\Controller\ResultFactory; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\...
0
votes
1answer
11 views

How to add product to customer cart in magento2 programmatically

Everything works well, but it adds for all by default, but I need it added for a specific customer, regardless of whether it’s active at the moment or not, I have a customer ID, but how can i add ...
1
vote
3answers
187 views

Quote id is empty when inserting multiple records into cart in magento2

I am adding product to cart from ajax by passing product id Here is my controller code. use Magento\Framework\Controller\ResultFactory; use Magento\Framework\App\Action\Action; use Magento\...
2
votes
1answer
36 views

How to concatenate the success message in magento 2 in cart?

I created a module to alter the cart message. app\code\Eight25media\Changemsg\etc\frontend\events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
1
vote
2answers
26 views

Getting error when using $messageCollection->getLastAddedMessage()->getText(); in magento 2

I created a module to add available qty to cart when customer request more than available qty. below is my code set. app/code/E25media/MagentoCommunity/etc/frontend/di.xml <?xml version="1.0"?&...
1
vote
0answers
21 views

Add multiple products to cart using product ids

I am trying to add multiple products to my cart. I have product ids in the form of $productIds = implode(',', array_column($points, 'productId')); which gives me numeric product ids like this : 5330,...
1
vote
1answer
26 views

How to add available qty to cart when customer request more than available qty?

As asked in the question, Is there any possibility to add available qty(in stock) to the cart when customer requesting more than available qty. How magento behave with this situation? ex : I have 5 ...
0
votes
0answers
15 views

requested product doesn't exist rest api

I'm creating rest api to add product to cart, it works okay for some users and doesn't for others. what is reason for that? here is the code: $customer = null; $isGuest = true; $quote = ...
0
votes
1answer
60 views

Fatal Error: 'Uncaught Error: Call to a member function setCustomPrice() on boolean magento 2.3

Here i am trying to add product to the cart using customerId and productId without customer logged in, it's working fine but its not adding custom Price to that product,please guide me if you have ...
0
votes
1answer
30 views

Get Product info from afterAddProduct Plugin in magento 2

I have a custom functionality for add to cart in product detail page. Once button clicked, sending product id and adding product to the cart. Used below code to implement it. <input type="hidden"...
0
votes
0answers
26 views

How to add product to the cart with customer id and product id magento 2.3?

Actually while adding product to the cart with product id and customer id, i am facing one error "We found an invalid request for adding product to quote." If anyone have any idea please guide me. &...
0
votes
2answers
36 views

Remove add to cart on category product

I am trying to remove the add to cart and add to compare buttons from the category page. At present I have used the following code: <referenceBlock name="product.info.addtocart" remove="true" />...
1
vote
2answers
59 views

Magento 2 How to Disable Add to Cart Button for Out of Stock Products

Magento 2.3 I have a 3rd part software I use for stock management so dont need Mangeto to manage my stock. If I set the manage stock option to no then the add to cart button on the product page is ...
0
votes
0answers
31 views

Magento2 Rest API - How to add dynamic option to cart item during adding product to cart

I am getting issue with checkout_cart_product_add_after event. Actually I have created one method with this event which adding dynamic product option during product add. Below is by code: public ...
1
vote
0answers
48 views

Automatically adding the character * (asterisk) at the input box without doing anything

I'm working on the compatibility of our client site. Upon checking, I have noted that in the checkout, on the field Postnummer it is automatically adding the character * in the field without doing ...
0
votes
2answers
54 views

send custom product price to checkout on add to cart in magento2

I have a custom price in phtml which is shown in the product page.Now I want to send that price to checkout page on add to cart click in magento2 that custom price is coming in js variable and input ...
0
votes
0answers
30 views

Magento2: How to restrict add configuration more than three products in configurable product

Magento2: How to restrict add configuration more than three products in a configurable product. Actually, In my case configurations restricted for more than three products and I am unable to find ...
0
votes
0answers
33 views

How to move my custom container after add to cart button in magento 2

How to move custom container (product.info.extrahint) after add to cart button in product detail page in magento 2 catalog_product_view.xml <referenceContainer name="content"> <...
0
votes
1answer
37 views

Magnto 2 update the cart custom option value

Currently am using magento 2.2.5, while adding the product to the cart the custom options values are stored in the quote_item_option table correctly. while updating the custom options ...
0
votes
0answers
19 views

Problems with button cart, and register in Magento 2.3.1

I test my Magento on ubuntu 18.04, In localhost, and i push the button a test product and he send a msg like this Your Session Expire , ok i going to register and when finish the form and send the ...
0
votes
0answers
41 views

Add to cart button is not working properly in listing page in Magento 2

I am using Magento 2.3.0 In Product detail page when we click on Add to cart button then the text in the button is changing from "Adding" to "Added" and then finally it displays "Add to cart" again. ...
0
votes
1answer
40 views

how to add another add to cart button in product page in magento2

I want to add customize add to add button near add to cart button and on that click, the product should add in the cart in magento2 I have followed this link:magento 2 Adding one more Add to cart ...