Questions tagged [addtocart]

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

Filter by
Sorted by
Tagged with
4
votes
1answer
1k views

add to cart button in CMS page

In Magento2.1, I'm able to load a product in CMS page using: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Catalog\Model\Product')-&...
4
votes
3answers
2k views

how to Redirect the page in Add to cart button click

I want to redirect the page when i am clicking add to cart button For ex : product_Name : Product1 Redirect_url : www.somedomain.com...\Product1 (other site url not mine) product_Name ...
4
votes
2answers
2k views

Add to cart redirect

How can redirect to a CMS page when the "add to cart button" (on a product view page) is clicked? I have already disabled the redirect to the cart page after the "add to cart" button is clicked. Now ...
4
votes
2answers
239 views

Magento 1.9 multiple add to cart button

I want to show two Add To Cart button in view.phtml page. those buttons are following, Add To Cart Insta Buy Add To Cart button working with normal functionality, It works fine. But When user click ...
4
votes
1answer
177 views

Reorder link using hash

I'm working on a reorder-module that will allow my customers to: a) Click a link i email b) Click a link in order history What will happend next is that: 1) Delete all items currently in cart 2) ...
4
votes
3answers
189 views

Change “add to cart” text for not registered users

What the best way to change text add to cart only for not registered users? Documentation recommend change dictionary file. https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/translations/...
4
votes
1answer
715 views

Bundle Products not adding to the cart in magento1.9.1.0

I am tackling with a strange problem in magento 1.9.1.0, the bundle products in my magento store are not being added to the cart instead when I click on the 'Add To Cart' button it's showing- Error ...
4
votes
2answers
1k views

Initial Form Key not Matching with Varnish/Turpentine in Firefox

I'm running into a weird issue with Varnish, Turpentine, and Firefox which is, in all likelihood, something very specific to the configuration of the system I'm working on. I'm asking about it here ...
4
votes
1answer
916 views

Magento Add Configurable Product to shopping cart

how can i add Configurable Product to shopping cart in magento ? i try this code to add simple product to shopping cart but it`s not work for configurable product $result = $proxy->...
4
votes
1answer
407 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 ...
4
votes
1answer
296 views

Add to cart not working in Magento 1.9

I have same issue in Magento 1.9 i'm using magento 1.9.3.2 Login to a customer accounts Try to add something to the shopping cart and place an order After order is saved go back to store and try to ...
4
votes
1answer
367 views

Keep the product in wishlist after the product added to the cart

When i add product to the cart at wishlist page, the product automatically removed from the wishlist and the product was no longer in wishlist page. Is there a way to keep the product at wishlist ...
4
votes
1answer
2k views

Magento 2: How to update mini cart after add product to cart from API?

I'm working on a task that need an API endpoint for adding product to cart in Magento 2. My code do the job "add product to cart" properly (it add product to cart and when I go to .../checkout/cart I ...
4
votes
5answers
3k views

How to add bundle product to cart programmatically with custom price and quantity (of all products) in Magento 2?

I am struggling with Bundle Product add to cart programmatically in Magento 2. Here I need to add all products with custom price and quantity and I want to do this operation in Product list.phtml ...
4
votes
2answers
2k views

Adding multiple configurable product variations adding first one multiple times

I'm trying to add multiple variations of a configurable product to the cart at once, and I've put the code together, but currently it's adding the right qty of products, but only using the first ...
4
votes
0answers
35 views

Unable to add multiple Products to cart in magento2

I have used below code in my controller. use Magento\Framework\Controller\ResultFactory; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; class Addtocart extends \...
4
votes
0answers
124 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 ...
4
votes
2answers
1k views

Magento 2 - After adding to cart, cart page showing empty

I have a magento 2 website and I am facing an issue where After you add to cart, cart page is showing empty. It's not happening all the time but most of the customers are facing this issue. Thanks
4
votes
1answer
631 views

Bundle product: Add to cart instead of select option

I want to add add to cart on product detail page instead of select option, how can it be done? As of now it shows select option on product detail page , but i want add to cart button that will just ...
4
votes
1answer
1k views

Add multiple products to cart using Magento2 REST API using custom method

Add multiple products to cart using Magento2 REST API using custom method Their is no default magento api this is single product add to cart json code in rest api body section. { "cartItem": { ...
4
votes
1answer
1k views

Tracking Ajax Add to Cart Event

I have a problem I've been struggling for a couple of days and I would really like you to point me in the right direction. I am developing a module to track basic stuff like addToCart and ViewContent ...
3
votes
2answers
7k views

Magento 2 Ajax Add to Cart

<form action="/checkout/cart/add/uenc/[key]/product/1/" method="post" id="product_addtocart_form"> <input type="hidden" name="product" value="1" tabindex="0"> <input name="form_key" ...
3
votes
2answers
3k views

Magento 2 Related products add to cart button issue

I'm using Magento 2 and I've noticed that on the related products block , on the product page , the add to cart button for the related products is actually a check box, and not a properly button.. is ...
3
votes
3answers
6k views

Replacement of an abstract class in custom module

I read a lot of information on this issue, but have not found a solution. I need to change the function getAddToCartUrl, in class Mage_Catalog_Block_Product_Abstract. Is there a way to make a ...
3
votes
3answers
153 views

How and where to change add to cart message in Magento 2?

I am using Magento 2.3.0 Above message displays when we try to add product more than available quantity from the product detail page. I want to change this error message and want to add a new custom ...
3
votes
1answer
78 views

Restrict product add to cart in magento 2

i am using magento 2.1.5, and i have two tax classes. and i want to add only one tax class product in cart at a time. if customer try to add another tax class product, it will throw the massage. for ...
3
votes
2answers
929 views

Magento 2.2.5 change 'Add To Cart' button to 'View Product' at category page

Is it possible to change the 'Add To Cart' button to 'View Product' at the category pages? I have for almost every product some attributes, so it's weird for my visitors to click on "Add To Cart" but ...
3
votes
1answer
1k views

Add to cart issue - Magento 2.1

In Magento 2.1 When I enable Ajax on add to cart on Product detailed Page by "bindSubmit": true in add-to-cart.phtml <script type="text/x-magento-init"> { "#product_addtocart_form": ...
3
votes
1answer
4k views

Add/Update customers cart from admin

Is it possible to add/update a customers cart from admin? $productId = 700; $storeId = Mage::app()->getStore()->getId(); $product = Mage::getModel('catalog/product') ...
3
votes
2answers
3k views

I want to set custom price programmatically to the product Magento 2

I want to set the custom price for the product programmatically.In my current code , the customer create programmatically and set the products to the newly created customer.But i want set all product ...
3
votes
1answer
465 views

Magento : Get Quantity of Added Product in cart_product_add_after Event

I need to get quantity of product being added NOT quantity of that product in cart. E.g. I am on product view page and set quantity to 5 and click on "Add to Cart". I need to get that quantity in ...
3
votes
2answers
321 views

Create new row in Database when we click on button

By Default Magento create new row in Database in table sales_flat_quote_item_option once we click on ADD TO CART We are giving an option of uploading custom image on Product image with help of ...
3
votes
1answer
255 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 $...
3
votes
1answer
384 views

How to find Customer cart overall weight?

How can I find customer cart overall weight?
3
votes
1answer
2k views

Magento 2: How to remove add to cart template from product detail page

I have to remove add to cart button from product detail page when product store has 0. How to achieve this
3
votes
1answer
982 views

How to change “add to cart” text on category view?

Where can I change the text below? Where is the file and where do i need to copy it in my custom theme? Thanks alot! :)
3
votes
2answers
1k views

How to create “buy now” button which should redirects to onepage checkout

I am new to magento, using Magento 1.9. with custom theme. I succesfully created buy now button on addtocart.phtml by the following codes: <button type="button" title="Buy Now" class="button btn-...
3
votes
2answers
2k views

Is there an event for apply coupon action in cart

I want to add a product to cart automatically when a coupon is applied. When the coupon is applied the product should be added to cart showing its price and a discount of the price of the product ...
3
votes
1answer
809 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:...
3
votes
2answers
63 views

Require js didn't load my Js in custom module

I'm working on a custom module for GTM. The last part I facing issue is with require js. I want to trigger a custom JS on "add to cart" click. I made a requirejs-config.js file in Vendorname/...
3
votes
1answer
313 views

Add to cart button for upsell product in product view page not showing up magento 2.1.9

In order to show add to cart button in up sell products i have added an upsell.phtml file inside app/design/frontend/your_package/your_theme/template/catalog/product/list/ my code for upsell.phtml ...
3
votes
3answers
5k views

Magento2 how to add configurable product to cart programmatically [duplicate]

Magento2 how to add the configurable product to cart programmatically. I searched but found question related to how add simple product mostly.
3
votes
1answer
2k views

Change product price before add to cart

I have custom price field for specific product where user can input their desire product price, and i try to add the product to the cart programmatically, the problem is i need to change the product ...
3
votes
1answer
345 views

Move up Validation in Configurable Product Page

Is it possible to move up label, below the fields? And where I can find it? I tried in validation.js, but didn't have much luck.
3
votes
2answers
622 views

Magento Change Product image while adding product to cart

I want to change product image after a user added a product in to cart, Because user can change image text and font style. So, I have loaded Quote item using event sales_quote_add_item and I am able ...
3
votes
1answer
1k views

Adding bundle product to basket - prices are zero

I know this problem is common, but the answers on the internet has not helped me, so I turn to you. I'm adding simple products to my basket and that works fine, but I also want to be able to add ...
3
votes
1answer
480 views

Forcing a certain custom option value when customer adding product to cart

I have a specific product that customers have made preorders for. Those who have preordered the product get it at a lower price. They can also order more products at the regular price. The pre-...
3
votes
1answer
322 views

Change the load order from addtocart block with the addto block

I getting crazy with the template system from Magento. I tried to change the load-order of my "Add to Cart" and "Add To" block for customize article. So that the "Add To" block gets loaded before ...
3
votes
1answer
816 views

What is the a good phone order extension? [closed]

We used to be on Volusion and their phone order page was quite nice. If someone called in to place an order we could add products to a cart from the admin side, edit prices for the customer and enter ...
3
votes
2answers
277 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; ...