Questions tagged [addtocart]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
54 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
38 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
151 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
11 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
22 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
15 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
45 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
38 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 ...
2
votes
1answer
64 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
16 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
102 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
23 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
67 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
449 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
14 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
289 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
46 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
28 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
22 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
28 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
17 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
102 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
35 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
33 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
39 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
208 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
48 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
52 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
104 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
31 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
42 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
42 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
21 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
100 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
60 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 ...
0
votes
0answers
11 views

on add to cart click save custom option data in datbase and display it on cart page in magento2 [duplicate]

on add to cart click, I want to save the custom option in database I have created all the model and controller files now how to add to cart button in phtml file is my question that on click that add ...
0
votes
0answers
137 views

Exception: Warning: Cannot modify header information - headers already sent by in magento 2?

In below program i got an error like Exception: Warning: Cannot modify header information - headers already sent in magento 2.I am not understand where i am writing wrong code.please help on this. &...
0
votes
0answers
7 views

Magento 2 in how to fix the cancel checkout and after cancel the pay amount to view the my card Qty is not showing?

I will try to change the Qty update but its not working.. How to fix this?
1
vote
1answer
116 views

Missing add to cart button on some items

We're experiencing a strange issue with our catalog, I'm scratching my head of where to start looking for... Here are the symptoms: Item X - doesn't have the "Add to Cart" Button. When I go to the ...
1
vote
2answers
168 views

Magento 2.3 - Add product to cart issue with store view

I have two stores with id 1 and 2. Am trying to add product programmatically using below code $params = array( 'form_key' => $this->_formkey->getFormKey(), 'product' =...
1
vote
0answers
15 views

Bulk add to cart function issue

I added multiple products in the cart using this below script. <script> require(['jquery'], function (jquery) { document.getElementById("add").addEventListener("click", function () {...
1
vote
0answers
119 views

Add multiple products in cart programatically magento 2

I am trying to add multiple products in cart programmatically. This below code is working properly but I need to set quantity dynamically. If quantity is not set that product to be skipped without ...
0
votes
0answers
10 views

how to pass product page selected value to cart in magento2 [duplicate]

I want to pass the product page custom value selected in product page to cart page in magento2 my all values are coming from the phtml page as you can see in the picture there are options to ...
2
votes
2answers
350 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'...
2
votes
1answer
33 views

How can I put this button 'add to card' above the product image?

How can I put this button above the product image?
1
vote
0answers
36 views

Before Clearing cart I want to show Popup for confirmation

I have added popup it show but not clearing item from cart just reloaded on same page. Please someone look in this. Below is the my script. <script type="text/javascript"> require([ '...
2
votes
1answer
140 views

Redirect issue after add to cart in magento2 custom controller

I am calling my custom controller for adding the product through the form action. Below is my controller file. <?php namespace {Vendor}\{Module}\Controller\Product; use Magento\...
4
votes
1answer
403 views

Adding products to cart programmatically, sets item's price to zero. First time Only

Certain products I have in my store have an attribute called setup_fee_sku. If the product has this attribute I grab the value (which is a sku) load it, and add it to the cart programatically. But ...