Questions tagged [addtocart]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
1k views

Add multiple items to cart in Magento2

I am implementing add to cart functionality from ajax using product id. This is my code of template file <tr class="border_bottom child-items selected"> <td >...
1
vote
2answers
1k views

Magento 2 get quantity of product in cart without loop

I have written a controller in Magento 2 that adds products to the logged in users account. The controller is working properly however i am facing a slight issue. You cannot add a product to your ...
2
votes
2answers
241 views

How to add multiple products to cart programatically in Magento 2

This is the code snippet that I am using $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $quote = $objectManager->get('\Magento\Checkout\Model\Cart'); $_product = $...
1
vote
0answers
26 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 ...
0
votes
0answers
35 views

Magento 1 show pop when product added to cart

Is there an easy way to show a popup that a product is added to the cart in Magento 1.9? The popup message itself will be no problem to create, but I need the code-part that checks and shows the ...
0
votes
1answer
414 views

Observer after product is added to cart

what is the name of the event that I can trigger after adding a product to the cart ? I need this : The customer adds a product to his cart Intercept the event thanks to the result of and API, add ...
0
votes
0answers
32 views

In Magento 2.2.5, Update the cart items with custom options

In Magento 2.2.5, I want to update the cart products with custom options. While adding to cart, It is added correctly and updated in quote_item_option table. While updating only qty is updated, ...
1
vote
0answers
22 views

How to get remain stock of product , if some of added in cart

I am just modifying magento add to cart ajax functionality. I want to check remain quantity of product if some is added to cart. But i tried ,many ways but i did not success. Instead of message ...
0
votes
1answer
82 views

Magento 2.2.1 - Disable Add to Cart for Specific Products

I need to figure out a way to disable the "Add to Cart" button on specific products. I found this link, but it creates a full attribute set which I don't want to do. How can you add an attribute and ...
1
vote
0answers
35 views

how to show different prices for login and non-login user on cart page in magento 1.9

There are two prices one for login user and other one is for non login user but when i click add to cart button it show login customers prices to non-login customers please help how can i fix this.
0
votes
1answer
209 views

Magento 2: Cache problem Cart items drops

Have been struggling with this problem for some time now and its a bit confusing. The problem is the following that my cart drops the products added when I visit a new category on the site. When FPC ...
0
votes
0answers
301 views

Magento 2.2.3 CE unable to add/remove item from wishlist?

We are getting facing an error message when we add (or) remove item from wishlist in magento 2.2.3 CE can you please advise? ? we didn't write any custom code from custom module. Fatal error: ...
0
votes
0answers
71 views

How to move add to cart at the last for each product in product list page magento 2?

How to move add to cart at the last for each product in product list page magento 2?
0
votes
1answer
51 views

How to enforce minimum quantity for a given sku?

I am seeking a way to enforce minimum order quantities for an individual SKU. This is for a member's only wholesale only website. Example: SKU: X6T, which has four color options (red,white,blue,amber)...
0
votes
0answers
22 views

Qty in cart always 1 for every product?

I am running a Magento 1.9.3.7 store with the Ultimo theme. No matter what I enter in the qty box on the product page, the number is always 1 ion the cart. I debugged a little and figured that there ...
1
vote
0answers
20 views

Magento 2. How to get every single Product ID

I'm trying to get Category ID and as well Product Id Like I want to get it for to show all 'add to cart' button for specific category if you can help me that how can I hide 'add to cart' button for ...
1
vote
1answer
37 views

Add to cart not working in custom template magento2

I am getting add to cart url by product object like below. Block file. use Magento\Catalog\Api\ProductRepositoryInterface; use \Magento\Checkout\Helper\Cart as CartHelper; class CustomAdd ...
3
votes
2answers
201 views

Magento 2. how to hide 'Add to cart button' using Plugins

How to Hide 'Add to cart' button using Plugins.I'm stuck in to hide add to cart button.
3
votes
1answer
1k views

Magento 2 . How to hide 'Add to cart' button while not logged in

This is how I tried but its not working Bodak/DisableAddToCart/etc/adminhtml/system.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
0answers
48 views

Query string to add product and apply promo code: M2

I currently have set up a query string that automatically adds a set amount of products to the users cart when they click a specific button. I already have everything set with with the FormKey() and ...
1
vote
0answers
29 views

Magento 2 How to hide price of product and add to cart button and Show a custom Link if not logged in [duplicate]

How to Hide the Price of the product and also add to cart button if the user is not logged in and want to give a link in place of Add to cart button to Login.
2
votes
1answer
155 views

How to implement ajax based toast notification for add to cart, wishlist and compare?

Is there any way to show toaster notification using jQuery for add to cart and wishlist and compare from product list page and detail page. Want to show some of the below toast notification after ...
1
vote
1answer
105 views

Floating fixed position cart

I need to add floating cart with product count in my site(screenshot_1). Which is now in header minicart. I need to fix minicart in right side of my site. How I can do that? screenshot_1
0
votes
0answers
48 views

add to cart programmatically doesn't work

I'm building rest api to dd product to cart but it doesn't work and returns quote = null. here is my code /** * @api * @param int $productId * @return \Magento\Quote\Model\Quote */ public function ...
0
votes
0answers
134 views

Magento 2 in Add to Cart page Remove item not working

Magento 2 in Add to Cart page Remove item not working. After Login Add to Cart page Remove Item not working?
0
votes
1answer
2k views

Magento 2- How to move custom options after cart button?

I want to move custom options below Add to Cart button and also want to move short description within form tag.How can I achieve this? Also I want to know why my custom php code not working in ...
1
vote
0answers
29 views

Getting error while adding image of product to cart using RSET API

I am facing one issue. I am adding configurable product to cart with its image,size and color but getting the below error using magento-2 REST API. Error: {"message":"The image content must be ...
1
vote
0answers
474 views

Custom Add to Cart on Bundle product page: Magento2

I want to customize my bundle product page on magento2 store and want different "add to cart" buttons for all the simple products of that bundle product i.e. if there are 3 products available in a ...
1
vote
0answers
156 views

How to add “Add To Cart” Pop Up Magento 2 Custom theme? [closed]

Here i am trying to add a pop-up once product added to cart using custom theme magento 2?? I tried this link
0
votes
1answer
140 views

Why Add to cart not working for complete magento 2 website in Internet Explorer

Here in our website Addtocart option not working in magento 2 for Internet Explorer latest version also.
0
votes
0answers
149 views

Magento 2| How to add “Add to cart” Button functionality in jQuery?

I am adding "Add to cart" button functionality in jQuery function for calculated product quantity. I have add simple button yet. I have doing it as: My function is: $(document).ready(function(){ ...
1
vote
1answer
365 views

Could not create cart for customer using magento-2 REST API

I need to create cart and get the quote id for the customer using magento-2 REST API but I am getting the following error. Error: stdClass Object ( [message] => No such entity with %...
1
vote
1answer
278 views

Magento 2 : Add product to cart as per customer with custom price programmatically

I need to add product to cart as per customer vise with custom price. I'm trying by below code. But, it returns error Uncaught TypeError: Argument 1 passed to Magento\Quote\Model\Quote::...
0
votes
1answer
65 views

Products can not be added to cart by click “Add to cart” for second time

I have Related products block in my product description page. I have configured a particular product's Minimum Qty = 5. So users can only buy products in multiples of 5. Below is the screenshot of ...
0
votes
1answer
210 views

Add to cart button from controller layout cause redirect to controller url

I've got controller that render products in .phtml with add to cart button and return it via layout to ajax. When i hit the add to cart button this makes redirect to controller page. I need to reload ...
1
vote
1answer
88 views

Change text and Relink the “Add To Cart” button in the product list page (list.phtml)

Do you know how to Change text and Relink the "Add To Cart" button in the product list page (need to change code in the file list.phtml). In my magento server, the list.phtml file is located in the ...
0
votes
2answers
61 views

Get param : Controller of custom product interface

I've created a page where I have a list of products. In each row (1 row = 1 product), I have a button "add to cart" : <?php $postParams = $block->getAddToCartPostParams($_product); ?> <...
0
votes
1answer
117 views

Show Pop Up when click on Add to cart checkbox for related products Magento 2.1.7?

How to show Pop Up when clicking on Add to cart checkbox for related products Magento 2.1.7? The pop-up message should be (The product has been added to cart)
1
vote
1answer
834 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->...
1
vote
1answer
77 views

Frontend suddenly showing code

We now have 'code' on our frontend. See image. Please advise
0
votes
1answer
241 views

Add to cart glide image animation | Fly to cart image animation. PHP/jQuery/JavaScript validation on successfully adding product to cart

I am trying to make a simple glide animation when adding product to the cart to indicate and "highlight" that the product was added. I managed to create a simple (not the best) glide animation for ...
1
vote
0answers
249 views

Magento 2 Ajax add to cart related products

So I've found the location to turn on ajax add to cart in the product page. I've also found where the; $showCart: true Lives to enable the related products to have an add to cart button on them. ...
1
vote
1answer
51 views

How to add multiple subproducts to the Magento 1.x cart at the same time?

I know there are already a lot of answers for how to add multiple products at once. I don't think this is a duplicate because here we are talking about subproducts not products. Currently on my ...
0
votes
1answer
128 views

Magento 2.2.5 How to add additional products to cart from new checkout step?

I'm a newbie in the Magento! I created the new checkout step "Additional Products" with 2 buttons - "next/skip" and "add to cart". I want to add required products to the cart, but I don't know what I ...
0
votes
1answer
175 views

How can I change add to cart button on category page to saw view more and route to product page?

Instead of adding an item to the cart from the category page I would like to instead have it simply route to the product page.
0
votes
1answer
140 views

How to add buy now button on product page to checkout page with the quantities

I´m not a programmer but I'm running my shop with Magento, I tried to use the suggestion below to create a 'Buy Now' button and works fine. But add only 1 unit of the product. How can I do to add ...
1
vote
0answers
30 views

Home Page getting error when try add product in cart Magento 2

I have created my custom theme in magento and designed default.xml as per my requirement, everything is working fine but getting error when trying add product in cart from home page, also minicart ...
0
votes
1answer
252 views

Magento 2 : How to get selected simple product Id on checkout_card_add_after observer?

I want to get selected associated product id after an checkout_cart_add_after triggered. If any helps would be appreciable.
0
votes
1answer
271 views

How to get selected simple product Id on checkout_card_add_after observer in magento2?

I want to get selected associated product information from configurable product after an checkout_cart_add_after triggered. I'll look after it in mean time,if any helps would be appreciable.
1
vote
2answers
585 views

Changing 'Add To Cart' button text and relink in Magento 2.2.6

Change "Add To Cart" button text to "Find Out More" and relink in Magento 2.2.6 Hello everyone! Does anyone know how to change 'Add To Cart' button text and relink the button? I followed these 2 ...

1 3 4 5 6 7 20