Questions tagged [addtocart]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

AddProductsToCart Mutation Custom Option Upload File Magento 2.4

I am struggling to understand the correct way to get a custom option that is an uploaded file to attach correctly when adding a product to cart via graphql. I have tried using entered_options: [ {uid: ...
0
votes
1answer
21 views

Overriding the addtocart button for third-party api

I am new to Magento2 and currently working on a project where some products can be custom-designed via a separate API. So when the add-to-cart button is clicked, instead of adding the product to the ...
0
votes
1answer
12 views

How to add item to cart?

How to add product to cart with price 0. It is something like an free product add to cart programmatic ally without any cart rule?
0
votes
0answers
12 views

Highlight the products added in the cart

I am trying to make functionality on the category page in which the product which is in the cart shows a right mark beside the product name. I am able to achieve it for the norma add to cart but I am ...
0
votes
0answers
28 views

Magento 2 : Update the product name while adding into the cart

I want to add something with the product name dynamically while adding to the cart. Each product have different concatenation with product name. And that product name should be updated on everywhere ...
0
votes
0answers
13 views

Add to cart not working magento 2

I have m2 store up and running, Due to some requirement I have to change my website to run on http instead of https, So from the backend I have changed base url to http instead of https and change ...
0
votes
0answers
18 views

Magento2: Add Dynamic Custom option on add to cart using rest api

Hope you all are doing good!!! I am not creating any custom option for products but need to add custom options to any simple products while adding to cart with rest api so can you please assist me how ...
0
votes
1answer
73 views

After upgrade Magento 2.3 to 2.4 can not add product to cart

After click button ADD TO CART , it's error Cannot read properties of undefined (reading 'remove') and mini cart is empty too
0
votes
0answers
18 views

Adding product with textfield customisable option programatically via route not showing option value in admin

I've got a magento store with some products which have a text field customisable option, and there's a module to add these products to the cart via a URL - where the product ID and option value are ...
0
votes
0answers
13 views

Qty and Add to Cart Not Aligned Properly For Configurable Products

I am using the default theme of Magento 2.4.2p1, and the Qty input and Add to Cart button do not align properly. They appear to be inline with the last attribute of the product options and move when ...
0
votes
2answers
24 views

Ajax Add to Cart validation - When customer add more products to cart than the stock quantity is available in Product

When user is adding/increasing quantity than how to we can restrict him ? He can't add/increase quantity more than available saleable quantity. How to we can apply validation for display error message ...
0
votes
1answer
14 views

I want to select multiple products using a checkbox and add to the cart all in a single click

Is there anything out in the marketplace like this already? I'm willing to put in the work to build the solution but thought I'd check here for some pre-existing module or partial code I could use.
0
votes
0answers
18 views

How to add bundle product to cart using Magento\Quote\Model\Quote\ItemFactory

I want to add bundle products to the cart using \Magento\Quote\Model\Quote\ItemFactory. I have tried the below code and it is working fine. /** @var \Magento\Quote\Model\Quote\Item $quoteItem */ $...
0
votes
0answers
17 views

Magento 2 add to cart of custom Product type

I have created a custom product type like a bundle product. The parent product has associated with some child products. Everything works fine except for one cart issue. If I add the parent product ...
0
votes
1answer
27 views

How to add additional fee to subtotal of checkout/cart using events and observers? magento 2

Basically, I am trying to add additional fees to the subtotal of checkout/cart based on product_type. Here is what I tried but I am not able to get print_r($item->getBasePrice()); because I want to ...
0
votes
0answers
10 views

Facebook Pixel issue in Magento 2

I am facing an issue of Facebook Pixel in Magento 2. Add to cart showing warning same as Page Views. How to i can figure-out this issue ?
0
votes
0answers
25 views

Add product to downloadable/customer/products/

<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $FormKey = $objectManager->get('Magento\Framework\Data\Form\FormKey'); ?> <form action="http:localhost:...
0
votes
0answers
25 views

Add product to cart by url in magento 2

On the configuration page, I define the product id, now I need to call the URL: http://localhost: 3000/custom point/secret/addprizeproduct in the browser and add this product to the cart - this is ...
0
votes
0answers
17 views

Add product to cart refresh when an exception thrown

I have a requirement to prevent a user from adding a product when a certain condition is not met. I created a beforeAddProduct plugin. At the beginning of the plugin i have this code: if(!$condition){ ...
0
votes
0answers
10 views

Add product to cart via phtml template

I have a separate product - id 2256, I would like to make it possible to add it through ajax in the template - i.e. there should be a separate button on the page - what is the best way to do this, ...
0
votes
0answers
19 views

Notify Customer on Product/category page that this item already in cart

I have to notify the customer that this product is already in the cart on the product page and category page too before Add to cart Button like product page For Category Page I have tried to get ...
0
votes
0answers
6 views

How to keep 'In stock' even though the qty is 0 after a csv file import

We are currently running a cron job to import sku, qty, and price every 30 min. If the qty for a product becomes 0, the stock status changes from 'In stock' to 'Out of stock' automatically, 'Add to ...
0
votes
0answers
26 views

Minicart and add to cart success message is not showing after product added to cart in Magento 2.3.3

Hello, I am facing an issue during add to cart. When a product added to cart then minicart is not loading also flash message is not showing. This is my product details page url "http://127.0.0.1/...
0
votes
1answer
29 views

Fill HTML space while KnockoutJS renders

I'm doing an extension for the shopping cart which consists on adding and removing quantities using + and - buttons without reloading the whole page. Thus I'm using Ajax for sending the request and ...
0
votes
1answer
18 views

Can't find the option to exclude SKU

I can't find this screen: I'm trying to exclude an SKU from a cart rule, How do I get to it? I got here: And I can't see where there's an option to choose SKU.
0
votes
0answers
64 views

Magento 2: Disable redirection to product page if requested quantity is not available on add to cart function

On catalog category page, when I add any product to cart and the requested quantity is not available, it redirects to product page and shows error message there. What I want is to display error ...
0
votes
0answers
15 views

Magento add to cart in sub domain not working

I have configured a staging environment from the live environment. I have completely copied all files and the exact database of live and configured staging. But, the issue is I can add to the cart in ...
0
votes
1answer
15 views

How to add only one product using Magento 2 REST API?

I am using REST API for Magento 2. I want to add 1 product only in Cart using REST API. Like if cart is empty one product is added is cart and if one product is in cart then remove that existing ...
0
votes
0answers
16 views

Can anyone resolve this issues? Two buttons (add to cart )are coming with the disabled mode

I need to apply the code for the add to cart button but it is coming in disabled mode hence unable to do the required changes.strong text
0
votes
1answer
29 views

Magento 2 : Double qty before add to cart

how to change the functionality of add to cart button like I click on add to cart then qty should be doubled? <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for ...
0
votes
0answers
33 views

magento 1.9 redirect to cart page

i am using magento 1.9 i have some products on home page and on category pages there is a button called "Buy Now" when user click on the button its make redirect to "Add cart" page,...
0
votes
1answer
21 views

Magento 2 - Show modal if no quote shipping address

I am trying to alert the user that they have not added a postcode into their session when clicking "Add to cart" I have created a mixin, "catalog-add-to-cart-mixin.js" within my ...
0
votes
0answers
19 views

Need to modify the product detail page for adding a button beside the add to cart button

<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** @var $block \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $block->...
0
votes
1answer
18 views

Upsell products in drawer cart

So, after i add an item to cart it will open a drawer with the information of that product added to cart and below that all his upsell products. In my CartController.php the code is like that: $...
0
votes
1answer
63 views

Magento 2: Change "Add to Cart" Button text When item is removed from the minicart

I rename the "addtocart" button text to "item in cart" when product is in cart. but if i remove item from minicart at that time i want to again set button text as "addtocart&...
0
votes
2answers
230 views

Magento 2: Change "Add to cart" button text to "Item in Cart" when item is added to cart

I want to rename the add to cart button as soon as the product is added to cart.
0
votes
1answer
105 views

Second add to cart button on product page does not add related products - Magento 2.4.2

We have a second add to cart button on our product page, using the following code, see below. But when a related product is checked and this second add to cart button is clicked, the related product ...
0
votes
0answers
15 views

Magento2: CA UK domain Add to cart not working

I have 2 other domains on my server. CA and UK, I am trying to add to cart product but nothing is happening. No log, No any error, Just AJAX called and then stop with success message: {"cart"...
0
votes
1answer
31 views

Magento 2 : Issue with cart rule

I have created a custom cart rule "Percent of product original price discount" I am checking If coupon discount is better deal than special price for the customer then to use the coupon ...
0
votes
1answer
76 views

how to get child item object while adding to cart?

I wanna put customize the code with qty while adding to cart product. For that I have created Plugin Magento\Quote\Model\Quote\Item and used addQty() method,but in this method I call quoteItem object. ...
0
votes
1answer
26 views

I have added one custom attribute for product named percentage. How can I add that attribute to product price after adding that product into cart?

I have tried below code. However its working fine but other products for which custom attribute is not being added from admin, I am not able to add to cart such products.
0
votes
1answer
27 views

Magento 2 Add product to cart programmatically returning to original price

I have a product of $1, because I change the price later. What I'm doing is that I send the price on an Ajax request to a Controller, just like this: $.ajax({ ...
0
votes
0answers
32 views

Redirecting to cart after product added to cart

Magento 2.3.5 Having some trouble getting a module I've been working on to redirect to cart after altering the cart contents. As you'll see below I started with Gaiterjones's BuyXGetY module (https://...
0
votes
0answers
22 views

Add multiple items to cart while saving cart

I've run into a problem with my code when I try to add multiple items to my cart. I've added a product with the ID of 7 to the cart and then i'm trying to add a product with an ID of 8 to the cart, ...
0
votes
0answers
21 views

How to redirect user to Cart page after "Add to Cart"?

I have made a custom .phtml file to show "Add to Cart" button where I call/use the .phtml file in a CMS page. Below is my code: <?php $sku = $block->getData('product-sku'); $...
1
vote
1answer
95 views

Magento 2 - How to have a custom "add to cart" button in CMS page?

So I am trying to add "Add to Cart" button in my CMS page. In one CMS page, I will have one item and multiple "Add to Cart" buttons. I'm wondering how can I do this? All the ...
0
votes
2answers
231 views

How to create new quote programmatically from old order after place the order in magento 2

I want to create a new quote based on the old order. I can create order programmatically but not able to just add to cart product in a new quote. I don't want to place the order. Need is only add to ...
0
votes
2answers
195 views

Magento 2.4 - How to enable ajax for add-to-cart button and wishlist button of product widgets on homepage?

I have added products on the homepage using the widget, how to enable ajax for add-to-cart button and wishlist button of product widgets.
0
votes
0answers
17 views

Magento1 : Get the total price from the quantity of products before adding to the cart

Goodmorning everyone. I am a web designer not a developer, my coding knowledge is extremely limited. Despite all the tutorials I've read, I have a hard time understanding the magento logic for ...
0
votes
0answers
14 views

Magento 2: Wishlist add all to cart button -> don't add items to cart with no price and 0 quantity

i am using a hide price attribute to hide the price and add tocart button for the product, on wishlist page when user clicks on "add all to cart" button, i want to restrict those product who ...

1
2 3 4 5
22