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
716 views

magento Shopping Cart is Empty on safari & explorer browsers when i add products on these browsers

My store Shopping Cart is Empty is always empty when I use safari browser and internet explorer to view my store and add to cart from this browser. Please, can anyone help me regarding this? What can ...
0
votes
2answers
788 views

Magento/php: adding product to cart with custom details and price

(Magento 1.9) I created a form to be able to customize a product and generate a preview sketch of what the end result would look like with a cost (this was done outside of Magento as an individual ...
0
votes
1answer
15 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 ...
2
votes
1answer
940 views

Magento2 - Add Custom Column in cart item table and insert data to custom column when product add to cart

i have added new column in 'quote_item' table. i want to add the data to custom column when user add any product to cart.
1
vote
2answers
557 views

Add to cart url returns invalid url

My add to cart url returns this. When i click it the products doesn't get added because it's invalid. This happens in the homepage. http://localhost/mage/index.php/checkout/cart/add/uenc/...
3
votes
1answer
60 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
27 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
1answer
87 views

Magento 2 : How to fire custom ajax before add to cart ajax fire in product detail page?

I have created custom extension and how to fire custom ajax before add to cart ajax fire in product detail page from my custom module. I don't want to override js in theme level. please suggest any ...
0
votes
1answer
763 views

Related product to have quantity added to cart

I need related products to have a quantity input on the view page and for the add to cart button to carry this quantity to the cart with the product. Can anyone advise, thanks.
0
votes
0answers
23 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
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
22 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
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 ...
5
votes
2answers
250 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
0answers
19 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
887 views

How can i do cross sell products blocks on add to cart popup box

How can i display my cross sell products blocks under add to cart popup box, my add to cart block, <?php class Cmsmart_AjaxCart_IndexController extends Mage_Core_Controller_Front_Action { ...
4
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
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
1answer
996 views

How to add onClick event to add to cart button

Magento version 2.1.9 I want to use facebook pixel on my magento site. I want to add onclick event to all "add to cart" buttons. Thank you in advance.
0
votes
0answers
18 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
73 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
901 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 ...
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 ...
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
1answer
841 views

How to make magento/checkout/cart/ input readonly and disable UPDATE button

I update the QTY based on case_size of a product. I've made an observer to do that. If the case_size is 144 and a customer buys two cases then QTY will automatically become 288PCS. When the customer ...
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
26 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?
4
votes
1answer
968 views

Add multiple products to cart using Magento2 REST API using custom method

Add multiple products to cart using Magento2 REST API using custom method Their is no default magento api this is single product add to cart json code in rest api body section. { "cartItem": { ...
18
votes
0answers
7k views

Magento 2: Uncaught TypeError: Cannot read property '*' of undefined in (section-config.js:33)

It's duplicate question but I am facing the same issue while adding the product & removing items from the cart page. I have spent almost a day to resolve but no luck hope someone could help me ...
0
votes
1answer
29 views
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
24 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 ...
1
vote
0answers
107 views

Magento2 : Having issue with product add to cart jmeter

I am using Magento2.2.5 and using benchmark_2015.jmx, Facing issue when test for logged in customer and adding product to cart, Cart shows empty. It's default magento benchmark_2015 script, stored in ...
2
votes
1answer
878 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
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 ...
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?
0
votes
1answer
34 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
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 ...
1
vote
2answers
165 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
921 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
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
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 ...
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
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
183 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
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
532 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 ...