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.

2
votes
1answer
874 views

Need add to cart functionality on product list page. (attribute: size, quantity)

I need add to cart functionality on product listing page. On the product list page I have size and quantity box and add to cart is directly placed on the shopping cart page. Currently it redirects ...
0
votes
0answers
12 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 ...
2
votes
4answers
4k views

Error when adding to cart 'No such entity with id = 0'

When I add a product to my cart I get the following error: No such entity with id = 0 This happens with every product in the store, can anyone help point me in the right direction?
5
votes
2answers
132 views
+50

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
9 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 ...
0
votes
2answers
29 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 ...
1
vote
2answers
122 views

Cart & Checkout blank Magento 2.3 after trying to add product to cart

In Magento 2.3 I am attempting to add an item to cart, however the cart shows empty and if I 'proceed to checkout' the checkout page is blank with just the loading gif icon. If I go to 'checkout/cart'...
4
votes
2answers
832 views

Magento 2 - After adding to cart, cart page showing empty

I have a magento 2 website and I am facing an issue where After you add to cart, cart page is showing empty. It's not happening all the time but most of the customers are facing this issue. Thanks
1
vote
0answers
19 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
12 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 ...
3
votes
2answers
1k views

Add to Cart button in Magento 2.1

I tried with button add to cart and it not working, app/code/Moo/Custom/view/product.phtml <?php $product = $this->getData('product'); $postDataHelper = $this->helper('Magento\Framework\...
0
votes
0answers
7 views

Upsell Products of child simple product not showing after adding configurable product to cart

This is what I tried. Select a product such as it has multiple size and colors eg. ABC hoodie, M , Red . Upsell products are added to this particular simple product. Now when I add the same product ...
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
146 views
+50

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
31 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
1answer
6k views

“Uncaught TypeError: Cannot read property 'submit' of undefined” while adding product to basket

I am working with a mobile theme. I am trying to make an ajax request to add the product from product detail page and show a pop up after the addition. But while clicking the "Add to cart" button it ...
1
vote
1answer
497 views

Magento 2 - custom price can not add to subtotal and grand total after add to cart

I want to add custom price for bundle products after adding to cart. I have used "checkout_cart_product_add_after" observer to do so. But it is adding custom price to product price, not in sub total ...
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
20 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,...
2
votes
1answer
2k views

Get selected Custom Options from configurable product

the following observer script looks for selected configurable options, to work out the qty needed and adds a simple product (#9236) to the cart. However, it only works for simple products. How can I ...
1
vote
1answer
25 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
12 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 = ...
3
votes
4answers
2k views

How to add bundle product to cart programmatically with custom price and quantity (of all products) in Magento 2?

I am struggling with Bundle Product add to cart programmatically in Magento 2. Here I need to add all products with custom price and quantity and I want to do this operation in Product list.phtml ...
0
votes
1answer
38 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
28 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
25 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. &...
2
votes
1answer
1k views

Magento 1.9.2 - Home page in grid format shows wrong number of columns, no add cart button

I'm a newbie Magento developer and I'm facing a couple of issues with the product grid view in the home page and category page. All this is with Magento 1.9.2.0, running on xampp. It looks the same ...
1
vote
0answers
291 views

Magento 1.9.x - How to speed up adding to cart

I am trying to speed up my add-to-cart buttons. Right now, it takes about 5 seconds from when you press the button until it goes into the cart. Seems a little excessive to me... This is being tested ...
7
votes
0answers
200 views

Magento2 Add to cart button in row with grouped Products

In Magento2 I want to add "Add to cart" button with qty for every single product of Grouped Product. Is it possible? How? I see that the form is only one. I need also to remove the standard "Add to ...
0
votes
2answers
1k views

Add to Cart Resulting in: Cannot add the item to shopping cart

I have this observer listening: sales_quote_product_add_after Inside the observer I run this code to change the price of the item when added to the cart. $item = $items[0]; $request = Mage::...
0
votes
2answers
35 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
33 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
19 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 ...
3
votes
2answers
2k views

How to override cart\addcontroller in magento 2?

I want this function in \code \StwBuyXGetY \BuyXGetY \Controller\Checkout\Cart\Add.php(this is written in magento 1.9, I want to convert it into magento 2). But I cant add any new function in add ...
0
votes
1answer
885 views

Get last added product in minicart magento2

After product is added to cart, I want to open minicart and mark it with some styles. I found http://magento.stackexchange.com/questions/141507/magento-2-open-minicart-when-item-is-added how to open ...
1
vote
0answers
44 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
1answer
30 views

I can not move to checkout page magento 2

I click on "add to cart" but can't move to checkout page, only move to this page. Product is not going to the cart. Anyone can help me solve this problem?
0
votes
2answers
32 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 ...
7
votes
1answer
2k views

Magento 2 Add to cart frontend event listener

I am trying to find good solution to execute custom javascript when product is successfully added to cart. Also this custom javascript need information about product that was added to cart (sku, qty, ...
0
votes
0answers
28 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
29 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
30 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 ...
6
votes
2answers
970 views

Product created programmatically unable to add to cart in magento 1.9.2?? It gives error “The product could not be found.”

public function createcustomerproduct($data) { Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $product = Mage::getModel('catalog/product'); try { $...
5
votes
1answer
1k views

Magento 1.9 :- Add to Cart Helper - not working

I've been trying to fix a problem on an inherited Magento 1.9.1 site - the problem is coming from a custom category page I think. The template is using the Add to Cart Helper - in what appears to be ...
0
votes
0answers
18 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
24 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. ...
1
vote
3answers
2k views

Remove Add To Cart Button in product List page magento2 without using template file

I want to remove Add To Cart button at category page. but I don't want to use template file. I did it for product view page using event. $layout = $observer->getEvent()->getLayout(); $...
0
votes
1answer
879 views

Add to cart Not Working Homepage [closed]

I want to show feature product on my home page but when I click on add to cart it take me to cart page and show empty cart but when I add product form category page or on detail page its working fine ...
0
votes
3answers
1k views

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

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 ...
0
votes
1answer
4k views

Magento 2 : Add to Cart Success Message in a Popup

How can I show Add to Cart success message ("You added 'Product name' to your shopping cart.") in a popup in Magento 2?