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.

1
vote
0answers
17 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
21 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
26 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
28 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
23 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
17 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
18 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
votes
0answers
28 views

Replicate add to cart button and minicart

I have added custom add to quote button that should work similar to add to cart button , on click custom button it should be added in custom minicart not in default mini cart what approach i should ...
0
votes
1answer
26 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
36 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
1
vote
1answer
49 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
38 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
7 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
28 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 ...
1
vote
1answer
58 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
29 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
35 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
55 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\...
3
votes
1answer
43 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 ...
2
votes
0answers
29 views

Delete and add product again from cart in Magento 2

I have used below code to delete quote item from the cart and add it again in my controller $referenceProductId = $this->getRequest()->getPost('product_id') $customPrice = 100; $params = ...
3
votes
2answers
106 views

Allow only one qty of item into cart in Magento 2

I have created a custom controller in my module and calling via ajax to add the item to cart. Below is my controller code. <?php namespace {Vendor}\{Module}\Controller\Product; ...
1
vote
1answer
32 views

How to remove Add to cart warning message without size color selection?

I have to remove the You need to choose options for your item. on Add to cart button when I don't select any color or size. I don't want to show this as a global message. I found that Add to cart is ...
1
vote
0answers
31 views

How to see the guest-cart in the webpage

I successfully added a product with the api rest using and the access point '/rest/default/V1/guest-carts/:cart-id:/items'. Now, I need to show this guest-cart in the cart page of the client Any idea?...
1
vote
0answers
10 views

Magento 2 : Getting issue during added non-visible product to cart through observer?

For this, I use below event observer <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...
0
votes
1answer
29 views

Button add to cart stays on adding… after i setParam('product', false)

I have a checkout_cart_product_add_after event that calls to a observer file in which i want to check a condition. If that condition is false i block the product from adding to the cart and want to ...
1
vote
0answers
42 views

magento 2.2.2 You need to choose options for your item

I want to add a configurable products to cart via ajax, for this I have tried below code but it always raised the error “You need to choose options for your item”. Code public function execute() {...
0
votes
1answer
28 views

how to get associated products id from checkout_cart_add acition in magneto

using observer after add to cart i am getting this Array ( [uenc] => aHR0cDovL2NpdHl0ZWNoLmxpbnV4c2VydmVyLmNvbS9saWNodGJveC9kcm9wLWFwLXBsLTQ1Y20tNjBjbS5odG1s [product] => 33890 [...
0
votes
0answers
28 views

How to add custom option before adding to cart by code in Magento 2?

I have a list of custom options that are adding to cart when click on Add to Cart button. But what i want i have created a custom select box with image,so it should be added to cart with image name ...
3
votes
1answer
76 views

Set Custom Price to Quote item magento2 from controller

I am adding the product to the cart with below code. class AddItems extends \Magento\Framework\App\Action\Action { protected $formKey; protected $cart; protected $product; protected $...
1
vote
3answers
39 views

Get productinfo from Observer controller_action_predispatch_checkout_cart_add

In Magento 2: I have created the event observer: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...
1
vote
0answers
57 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
2answers
50 views

How to restrict customer only to add products in cart Magento 2?

I need to integrate a functionality where when a user clicks add to cart it should check whether he is a logged in customer or not. If he is a logged in customer the product should be added in cart. ...
1
vote
0answers
32 views

Magento 2.1 : Add to cart adds 2 products from PDP

In magento2.1 add to cart button adds two quantity in cart when you press it for second time. I mean, on product page when add a product to cart it's ok and adds 1 qty. But on second time when I press ...
1
vote
0answers
18 views

How to create a “add to cart link” on a website that uses Magento?

I want to know how to create a "add to cart link" on a website that uses Magento. A retailer’s website uses Magento, I want create add to cart urls to post on my instagram people could directly check ...
2
votes
1answer
24 views

Can't add products to shopping cart / cart keeps loading Magento 2

I recently copied a website over to another host by using the import tool. After this I don't seem able to add items into my shopping cart. The button keeps saying loading and the Ajax loader shows ...
2
votes
1answer
136 views

Magento 2 translate the “You added … to your shopping cart.” line

I'm trying to translate the "You added ... to your shopping cart." line in my Magento 2 installation. I have already a .csv file in: "app/design/themevendor/themename/i18n/" with all the lines ...
1
vote
0answers
26 views

Configurable Product Sold Out - Showing in stock / Add to Cart and Drop Down Blank

We have set a configurable product and it has sizes below. When all sizes are sold out the add to cart is still present and the drop down for size is visible with no item i.e small The product also ...
0
votes
0answers
15 views

Magento 2 : How to display default Loader when add to cart on list page?

I want to display default loader of Magento 2 while add to cart from category page. currently customers are confused about adding product to cart. Please give me some solution or suggestion.
0
votes
1answer
55 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 ...
1
vote
0answers
62 views

Magento2 : Grouped Product's child product add to cart issue

I have an issue in grouped product's child product add to cart validation issue. In one grouped product have three (3) child products while click on add to cart button of last child product without ...
2
votes
0answers
410 views

Your session has expired magento 2.3 [closed]

when i want add to cart product it showing error Your session has expired how i solve this problem.
1
vote
0answers
16 views

How to add bundle product to cart?

How to add bundle product to cart automatically with addproduct method , without customization page , help me please or. Is it possible ?
0
votes
0answers
17 views

How to Hide/Show Product's particular Customizable Options on button click?

I have made a custom button that would be shown on the Product details page instead of the "Add to Cart" button. Now on clicking that button, I want to show some customizable options that are going to ...
1
vote
2answers
80 views

Remove block from layout depends on condition

I want to remove block product.info.addtocart from layout depends on some conditions
1
vote
1answer
39 views

Magento 2 Bundle Product Add To Cart Like Simple Product

We have bundle products that are just groupings of simple products. I have disabled all options for the bundle products so that customers can't edit quantities etc. because I want them to act like ...
1
vote
0answers
174 views

Expected to start loader but did not find one in the dom - Ajax Call Magento 2

I have implemented Ajax call to add product to cart, which is somewhat like below: $.ajax({ showLoader: true, url: SERVER_URL+'common/custompurchase/addtocart', data: data, type: "...
1
vote
0answers
22 views

how to edit quantity in cart with ajax magento 2?

I'd like to know how to change the quantity of a product on front using ajax ? When I change the quantity in the input and them click on the small pencil to apply modification, I'm redirected to the ...