Questions tagged [addtocart]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
580 views

Magento 2 - Programatically adding product to cart adds item with price of zero

When adding a product to the cart programatically, the product is added with a price of zero. Having read other questions on here with similar requests, I have added in $this->quote->...
0
votes
1answer
591 views

How to add product into shopping cart by single click using custom module in magento 2?

My template file code is $listBlock = $this->_listBlock; $addToCartUrl = $listBlock->getAddToCartUrl($_product); ?> <form data-role="tocart-form" action="<?php echo $...
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
11 views

Error Exception message: The product's required option(s) weren't entered. Make sure the options are entered and try again. Magento 2

Hi @all actually i am facing Error Exception message: The product's required option(s) weren't entered. Make sure the options are entered and try again. Magento 2 error while Products addToCart ...
0
votes
2answers
592 views

how to add product to cart by url?

I need a add to cart URL for add the product to cart by open this URL in any browser. I get the add to cart URL by this: Mage::helper('checkout/cart')->getAddUrl($simple_product) output of above ...
2
votes
1answer
20 views

Magento 2: Add multiple products to cart programmatically does not work if cart is empty!

I have the same problem as mentioned in this Question: Magento 2: Add multiple products to cart programmatically But it was never answered. This is my Controller.php: <?php namespace MassiveArt\...
1
vote
1answer
37 views

Magento 2.3.X : Display error message when user add more products to cart than the stock quantity in

Thank you for reading my question. I am working on a Magento 2.3 version and facing an issue which is When I add the product to cart more than the available stock it doesn't show the error ...
2
votes
1answer
26 views

Magento 2: After adding products to cart programmatically, cart is not refreshing until reloading page

Hello Magento 2 Friends. I have an ajax call to an controller, which adds some new products to the cart programmatically. This works fine, but the problem is that the cart and the mini cart are only ...
0
votes
1answer
13 views

Magento 2 limit max length in Qty field

I wan't to know how to set a max length for the Qty field that is when you click a product (I guess it's product View) I tried to override the following template and set maxlength = "4" but did not ...
0
votes
1answer
19 views

Tier prices are not applied on adding to cart

I have set tier prices on products. while adding to cart the price should be like attached screenshot. Normal price is 30 while for 2 it will become 29.5 but after adding to cart it still shows 30 for ...
10
votes
3answers
33k views

Getting quote (cart) items programatically shows duplicate SKUs for both the configurable and simple product

I'm getting the shopping cart using: $cart = Mage::getSingleton('checkout/session')->getQuote(); And then iterating through it using: foreach ($cart->getAllItems() as $item) { } But it seems ...
0
votes
0answers
17 views

Add to cart very slow after install amasty full page cache

I installed Amasty full page cache(1.8.21) to speed up my site(magento 1.9.4.1 porto theme). everything is fine but after a few hours adding products to the cart is very slow. but when i flush caches, ...
19
votes
1answer
8k 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 ...
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
2answers
806 views

“Shipping address is not set” error when saving cart

I have a simple code, where i add a simple product to the cart $cart = $obj->get('\Magento\Checkout\Model\Cart'); $cart->addProduct(5, 3); $cart->save(); but the last row, returns this ...
2
votes
4answers
1k views

Add Qty to Product before adding to cart

I am looking for an event observer which is suitable for my requirment. My requirment is i add to cart the product but qty i want to add to this cart will be decided by the product attribute. I will ...
0
votes
1answer
796 views

How I can display Links in add to cart success message?

One of my project when i'm clicking on the add to cart button it will display the success message but with links as plain html as follow- You added Advance/Breaker Housing Screw & washer Pk/6 to your ...
6
votes
2answers
996 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
6answers
4k views

I am trying to add link to the success message in Magento 2

I am trying to add a product details link in the success message after a user clicks the add to cart button. So I create a variable in my controller but and want to send cart link. Here is file ...
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
0answers
7 views

How to preserve product form values if validation fails when adding to cart?

We have some configurable products in our store with 3 configurable attributes and 3 customizable options. All of these attributes and options are required. When a customer is on the product page, ...
1
vote
1answer
106 views

after magento upgrade 1.7.0.2 to 1.9.3.9 add to cart after blank screen open

URL like generate https://domain.com/stage/checkout/cart/add/uenc/ how to solve it this issue Thank you in advance!
1
vote
0answers
18 views

Magento 2: Rest API throws error “The consumer isn't authorized to access %resources”

Working in to the rest API and checking with the postman storeConfigs, storeViews, currency etc... API working fine but i am workign on Add to Cart API and it's throwing in below response. "message": ...
0
votes
3answers
3k views

Magento 2 : “Invalid address id” when adding product to cart

When I add a product to the cart, it shows the error "Invalid address id". How can I solve this issue?
0
votes
1answer
427 views

Extra Add to Cart Button for simple Product

I have a website, sell a products with and without installation service. I want two add to cart buttons, one with and one without installation on a product page. The price for installation is variable ...
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?
0
votes
0answers
36 views

Magento 2 Dropdown for Quantity instead of text box

I tried this solution it worked perfectly for me on my Magento 2.2.9. I just wish to extend it with the below functionality - Quantities for the drop-down to pick up from the Tier Prices for the ...
0
votes
0answers
18 views

Cart edit page deletes all the previous saved data

I have added some of the products to the cart and then want to edit it. So, I have clicked the edit button, but after clicking edit button it deletes all the previously added products. How can I ...
0
votes
1answer
33 views

Magento 2 cart keeps loading

I have a weird bug. Every time I add a product to my cart it shows as if it were loading. However, it adds the product to the cart, if I switch to another page or reload the loading disappears and ...
0
votes
0answers
26 views

How to Restrict product add-to-cart if cart has specified category of products?

If my cart consists category id = 4 products, no other products eligible to add-to-cart, how to restrict by using anything, i tried using observer it not work.Please any one help.
5
votes
4answers
9k views

Add product to cart programmatically invalid request for adding product to quote

I'm trying to create a controller to add a product to the cart programmatically in magento 1.9, like this: <?php class Namespace_Module_IndexController extends Mage_Core_Controller_Front_Action{ ...
0
votes
2answers
71 views

Restrict products to purchase using Observer not trigger

Condition: I have restricted category of products [category id = 680, 894, 895], this category of products should be purchase alone, not mixed with other products. Workout: Case 1: If cart had other ...
7
votes
0answers
219 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 also need to remove the standard "Add to ...
1
vote
1answer
1k views

“Please specify the product required option(s).” for downloadable products when adding them to cart programmatically

I don't understand what might be going wrong, but even if I add "links" (downloadable product's links) to product's params, when I try to add it to cart I get the following error: {"qty":1,"status":"...
0
votes
1answer
37 views

Add configurable products to cart display waring message instead of redirecting

In magento 2, by default, if I try to add configurable products to cart when not selecting any swatch values, I will be redirect to product page. How can I prevent this and display a message like in ...
0
votes
0answers
14 views

How to highlight simple product associated to grouped product , which is added to cart on pdp page

I have a grouped product page where I need to highlight the simple product added to cart. When someone adds an simple product to cart I need to change the colour of the simple product div on product ...
1
vote
1answer
589 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 ...
0
votes
1answer
651 views

Magento 1.9 add to cart button validation

I am new in Magento field. can you buddy help me to make understand how "add to cart button" validation HTML filed can find and works .? I reached /var/www/html/magento/app/design/frontend/rwd/...
2
votes
1answer
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
1answer
677 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 ...
0
votes
2answers
2k views

Dropdown for add to cart qty in Magento 2

Rather then having input box I would like to place dropdown for product qty to add to cart. so to do I've done following In my \app\design\frontend\Vendor\...
0
votes
1answer
29 views

Magento 2 Move delivery time below add-to-cart-button

I want delivery time shown after add-to-cart-button. I have already have custom catalog_product_view.xml with this entries: <referenceBlock name="product.info.overview" remove="true"/> <...
6
votes
2answers
4k views

Remove success message after show

I custom add to cart module on Magento 2 and keep message like Magento core. if (!$this->_checkoutSession->getNoCartRedirect(true)) { if (!$this->cart->getQuote()->getHasError()) { ...
0
votes
0answers
13 views

Quote Items are showing only if flush cache - Magento 2

I am trying to get cart quote items by the following code: File: app/code/Essence/Fcf/view/frontend/templates/packages.phtml I called this file in my cms page by following code: {{block class="...
0
votes
0answers
22 views

How to pass the configurable product options in magento2 add to cart Url

How to pass the configurable product custom options to magento2 add to cart url. Thanks
0
votes
0answers
66 views

Magento2.3.1 getting issue when update qty

How to solve below error when trying to update qty in cart? "Something went wrong while saving the page. Please refresh the page and try again."
1
vote
1answer
972 views

Magento Community 1.9.1 RWD theme: Home page “add to cart” failure

I just noticed that when I used the 'add to cart' button on the home page of my site, it doesn't work in Firefox or IE.... it only brings me to an empty cart. It does work in Chrome however. I've ...
1
vote
2answers
612 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/...
0
votes
0answers
18 views

Products QTY and Add to Card in Admin

I need to create a Custom Module for update fast QTY (increase or decrease) in stock. My customer don't want to open each product and go to inventory and type the current stock and save. For this I ...