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.

17
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 ...
8
votes
0answers
232 views

Magento 2: Observer add product to cart?

I've read some other post about adding products to cart, but nothing seems to fit. I've an observer for checkout_cart_update_items_before that adds another product in same qty if specific product is ...
7
votes
0answers
201 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 ...
7
votes
0answers
522 views

Magento 2: How to make custom fee taxable

I want to add a tax on custom fee. tax calculation is perfect and gets tax amount but it's not set in TAX files in quote_address in the database. public function collect( \Magento\Quote\Model\...
4
votes
0answers
89 views

Removeing exist item during update items from cart : magento 2

I am doing some customization work on cart page. I want to add product multiple times with same configuration during update items. Add to cart is working good but existing items get removed during ...
3
votes
0answers
222 views

Magento 2 - Add To Cart Button Direct To Product Details With Non Required Options

I am on Magento 2.1.1 and I am trying to change the Add to Cart button behaviour in Grid / List Views. At the moment, the add to cart button only directs the customer to the product detail page if ...
3
votes
0answers
74 views

adding an item to the shopping cart does not add the first time; it does add the second time

This has been happening for a long time - when I add an item to the shopping cart the first time - it does not add to cart! The second time it does add... My Magento version is Magento 1.9.1.0 This ...
3
votes
0answers
1k views

Is there any way that one swatch is selected by default (magento configurable swatches)

I am trying use Magento Configurable swatches in my website (for colors). But I am facing some issues, in Product details page, we have to select one color swatch. In Product Listing Page, we are ...
2
votes
0answers
41 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 = ...
2
votes
0answers
25 views

create order on admin panel

How i can create one order from simple product if i just have simple product Sku ? or may by should i asked solution for save quote item on Frontend and create order on admin panel . i guess i ...
2
votes
0answers
78 views

Why the total product price in the shopping cart does not include the different product options selected?

Here is the issue that happened since my Magento installation has been restored. The shopping cart should normally include all the product options selected but since the restoration, only the product ...
2
votes
0answers
16 views

Magento 2.2.4 - unable to print messages. - New Theme

I have a Module which processes a Post action, and then redirects. for example i am trying to overwrite - Magento\Checkout\Controller\Cart\Add I have used my construct function and my method as ...
2
votes
0answers
166 views

Magento 1.9 : Add value to file type custom option when adding product to cart programmatically

I am calling $cart->addProduct($product, $params); for adding product to cart. Where, $product is product collection & $params is as follows as received from product page. Array ( [...
2
votes
0answers
180 views

Magento2.2.x Custom page side bar in display mini cart items

My custom page in displaying all product with add to cart product functionalities I want display mini cart items on page sidebar. after add to cart item update and display in that sections. like that....
2
votes
0answers
93 views

Magento 2 without user login add to cart ajax not working with redis session

I have Issue with Magento version. 2.2.0 with integration of redis session. In my magento 2.2.0 Redis Session is enabled , Now when user is not logged in(Guest User) to the system and try to add the ...
2
votes
0answers
104 views

Magento-2 update product custom option value in custom add to cart process

I want to update custom option value in add to cart. After add to cart i want to change product custom option value for perticular customer.
2
votes
0answers
1k views

Magento 2 add to cart button not showing for any product

On my magento website, add to cart button is not showing on any product page. I have checked inventory, visibility settings everything is correct still its not showing. can anyone please help ...
2
votes
0answers
468 views

The element 'product.info.options' already has a child with alias 'text' - Magento 2.2.0

After data migration (1.9.1 CE - 2.2.0 CE) I got the below error when I click add to cart button in magento 2 we can't add this item to your shopping cart right now I did research about this but ...
2
votes
0answers
327 views

Add a quote instance to cart: Magento 2

I am working on a custom module that is creating quotes using the Magento quote module. It is using the \Magento\Quote\Model\QuoteFactory for creating the quotes. Now I want to checkout the items ...
2
votes
0answers
155 views

AddToCart using GET and Query String in Magento 2.2

I am currently migrating a store from Magento 1.7 to Magento 2.2 On many of our product pages there is a button to order a free sample which is achieved by adding a product 'free sample' with options ...
2
votes
0answers
600 views

Magento 2: How to move the tier price table under the quantity input box on product view page

I am working on the product catalog page using my customized theme. Is it possible to insert my customized tier_prices.phtml inside my customized addtocart.phtml file? I need to put my tier prices ...
2
votes
0answers
235 views

Add product to cart programatically is not setting price when we add product at first time

When adding product first time to the cart is not setting the product price, But when we add another product to the same cart (second time) the price of both product is set. my code is below: public ...
2
votes
0answers
945 views

Shopping cart always “empty” after 1.9.3.4 upgrade

I have upgraded magento to 1.9.3.4 via magento connect from 1.9.3.3 and now whenever I try to add a product to the cart it says shopping cart empty. I added <?php echo $this->getBlockHtml('...
2
votes
0answers
44 views

Customise “add to cart” button

I want to edit the standard "add to cart" button to a "CLICK TO BUY" button. So that, once clicked will link through to the same product on another store (same magento install). Store 1 is a trade ...
2
votes
0answers
95 views

Special Order date picker that validates time frame before add to cart

I am fairly new to magento2 and I am working on developing a date picker that validates if a special order can be placed in time. The time frame would be different for each manufacturer on the site ...
2
votes
0answers
302 views

Magento 2 : Configurable Product Quick Add to Cart Not Working

I am on category page and want to quick add product to cart. It works fine for simple products but not for configurables. I select color and size and click Add to Card and it redirected to product ...
2
votes
0answers
96 views

Add Product then error show in magento 2

I have click add to cart product then get the error: Cannot read contents from file : "C:/Users/Admin/AppData/Local/Temp/D:/xampp/tmp/phpC9A.tmp" Warning !file_get_contents(C:/Users/Admin/AppData/...
2
votes
0answers
365 views

Magento 2 add to cart button validation

How can I keep Add to cart button disable until end user filled all the required option for product?? For e.g. If products has required attributes like color and size then at first add to cart button ...
2
votes
0answers
387 views

Magento 2.1.1 two add to cart button in product view page

I want to have two add to cart in product view page. So from somewhere I've found the following code <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); ...
2
votes
0answers
242 views

Magento 2 : How to make/call section ajax to show popup after cart update?

I want to make a new section popup like minicart. And need to update that on any cart action like addtocart, delete item from cart. For this I am thinking to make a section ajax call. How can I do ...
2
votes
0answers
111 views

how to group products dynamicaly and add same product separately into the cart page?

I have some products which are selected on front end by the customer and want to make the group of that selected product and add to cart as a single view. How to add same product separately into the ...
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. ...
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,...
1
vote
0answers
46 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 ...
1
vote
0answers
9 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
46 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 ...
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([ '...
1
vote
0answers
53 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:...
1
vote
0answers
55 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() {...
1
vote
0answers
79 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 ...
1
vote
0answers
34 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 ...
1
vote
0answers
30 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 ...
1
vote
0answers
90 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 ...
1
vote
0answers
17 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 ?
1
vote
0answers
284 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
25 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 ...
1
vote
0answers
166 views

How to get Child product according to option selected from Configurable product Magento2

I have this code in my addtocart : <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry(...
1
vote
0answers
22 views

magento 1 additional option of type file to cart programatically

i want to add custom option of file type while product is adding to cart. like i will be giving a customer an option to choose image from his computer, and when customer choose and hit add to cart ...