Questions tagged [cart]

Question related to the shopping cart: adding/removing products, shoping cart price rules, the appearance of the shopping cart page.

Filter by
Sorted by
Tagged with
45
votes
5answers
113k views

How to get all items in cart currently?

I want to get a collection of all the items in cart currently. How can I do this ? Any suggestions will be appreciated.
33
votes
8answers
14k views

Questions to expect in an interview for a Junior Magento Developer Position

Firstly I would like to say that I hope I am not posting in the wrong place with this question and if I am please advice me of where (if anywhere in the stackexchange world is appropriate) I should ...
32
votes
2answers
3k views

Magento 2 - Why is Magento\Checkout\Model\Cart deprecated?

Since Magento 2.1, Cart has a @deprecated tag. Nevertheless, it is still used by Magento itself to store products when shopping. Is the deprecation intended, and if so, and what should we use instead?
31
votes
4answers
17k views

Modify tax rate on cart quote items and recalculate

I have a category of products which (legally) need to have their tax rate changed when you are ordering more than a certain quantity. I have extended the various tax models to get this working when ...
27
votes
8answers
29k views

Cart dropping all items / cart session clears

A site I manage suddenly (potentially 2 weeks ago - from GA stats, and only reported now) started dropping the cart items when you view the cart, or go to checkout. The top 'mini-cart' shows the ...
23
votes
4answers
47k views

Magento 2 - How to get all items in cart?

At checkout page (chekout/cart) I want to edit the checkout button url destination based on cart items (link.phtml). How can I get all items in cart? I want to do this without using the API. Thanks.
20
votes
3answers
22k views

Magento 2 remove “Estimate shipping costs and tax” from cart

I want to get rid of the "Estimate Shipping costs and Tax" block in the cart. The devdocs tell Disabling a component is the way to go, so I tried the following: <body> <referenceBlock ...
18
votes
6answers
8k views

How to allow only one product in a cart?

We have a requirement, wherein a customer will be allowed to add only one product to the cart at a time. However he/she can add any quantity of that product. How can I prevent a product from adding ...
16
votes
4answers
2k views

EE 1.14.2 / CE 1.9.2: Quote items not merged correctly on login (duplicate products in cart)

I found a weird bug in Magento EE 1.14.2 (also affects CE 1.9.2) with the cart. Steps to reproduce: Log in as customer A Add product X to the cart Switch to a different browser Add product X to the ...
15
votes
5answers
11k views

Pop up minicart when I add a product to the cart magento 2

I'm using magento 2.0.7, and what I'm trying to do is to popup the cart(the top right cart ajax minicart) when I add a product to it, Basically trigger it. I have tried to add the "showcart" class to ...
15
votes
2answers
11k views

Creating Custom option and prize to just added product to cart using observer

I want to add custom option to quoteitem using observer which observer checkoutCartProductAddAfter event and fires after product added to cart. public function checkoutCartProductAddAfter(...
15
votes
4answers
4k views

Adding multiple items with different attributes to cart programmatically

I'm making a bulk add to cart system. Please note : i want it to works for simple products with with custom options -> Where custom option are like color(red , green , blue) or Size(Xl, M , S) ...
15
votes
2answers
2k views

sorting cart items by 'updated_at'

This is how i'm getting the cart items: $quote = Mage::getModel('checkout/cart')->getQuote(); $items=$quote->getAllitems(); I'd like to do something like this: $items->sortBy('updated_at','...
15
votes
2answers
942 views

How to update Shipping rates using Ajax when cart item is deleted on Checkout-Cart page?

My Shipping rates are calculated based on item present in cart and now on deletion of item on Checkout/Cart page, I need to update the Shipping rates. As of now, Remove Item on Checkout/Cart page ...
15
votes
3answers
2k views

magento 2 remove mini cart item page reload?

How can I reload the page when I remove mini cart item ? I know it's Magento 2 bug. On the checkout cart page there are many products In mini cart as well as In checkout cart page when I remove In ...
14
votes
1answer
9k views

Customization of total order and additional infos

When want to have the following style of totals on checkout/cart: Discount Subtotal Shipping fee OR Info Text: "excl. shipping" Additional text: "free shipping from 30EUR" (display always) ...
12
votes
2answers
17k views

difference between cart getItemsCount() and getSummaryCount()

I am displaying the total items present in the cart at header. I am able to display the count of items. But I am bit confused between two methods of cart 1. Mage::helper('checkout/cart')->...
12
votes
5answers
14k views

Auto update cart quantity when change quantity

In the default cart of Magento, when the customer edit the quantity, he/she needs to press the button to update the quantity. Is there a way that the cart update the quantity automatically when the ...
12
votes
2answers
865 views

Magento2: Minicart is full while Cart is Empty

A lot of our customers are complaining that they add stuff to the cart & then when they proceed to checkout they are redirected to an empty cart. We thought that it might be a result of too short ...
11
votes
1answer
1k views

Magento 1.9.3 : How to display custom options price (separately) on cart and checkout page?

I want to display custom option price on cart and checkout page. I follow this URL but its display error "Fatal error: Call to a member function getValue() on a non-object " on app/design/frontend/...
10
votes
4answers
14k views

Magento 2 Get Cart Quote Total in minicart.phtml

I'm trying to get the cart quote total in minicart.phtml, but I'm having no luck. I'm injecting Magento\Checkout\Model\Cart. Here's my code: $this->cart = $cart; $cartQuote= $this->cart->...
10
votes
3answers
35k 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 ...
10
votes
1answer
1k views

Multiple Cart or Split Quote in Magento2

I want to show two cart for normal products and vendor products. I don't think it possible to create multiple cart either by splitting quote or creating multiple quote. Because Magento 2 separate ...
9
votes
6answers
305 views

Magento 2: Changing Price of Product in Controller doesn't work at the moment!

I tried to change the Price of my Products like this: Controller.php: [EDIT] <?php namespace MassiveArt\ShoppingCart\Controller\Index; use Magento\Catalog\Model\ProductFactory; use ...
9
votes
2answers
11k views

Magento 2 : Updating quote item

I am trying to update quote item in magento2. But every time i am saving the item its creating a new item with the same quote id rather than updating it. Here is my code public function ...
9
votes
3answers
10k views

Magento2 Correct Way to get Order items

I am working on M2 Payment Extension our merchant need us to send items details along with order Everything works fine but $order->getAllItems(); or $order->getAllVisibleItems(); returning ...
9
votes
2answers
5k views

Magento 2 : Add Custom Tax Amount In Cart Programatically

I want to add custom tax amount to checkout cart programmatically. Here is the example. Cart Old Tax = 4.21 Custom Tax = 2 New Tax = 4.21 + 2 = 6 Check the screenshot below. I need this done ...
9
votes
1answer
101 views

Persistence Lifetime not working in Magento 2

I have configured Persistence Lifetime on Magento 2 but it's not working as expected. I have configured 60 seconds cookie lifetime but it's not affecting the same. I have checked with default Magento ...
8
votes
2answers
7k views

Disable entire cart functionlity & checkout in magento2

From admin side i can disable one step checkout,but still users can add products to cart.I want to display only products without checkout. Is there any extension there? I mean disable mini cart,add to ...
8
votes
3answers
14k views

Disable redirect after product add to basket

When I add something from the category to the basket/cart it redirects me to the basket/cart. After searching I found that I could turn this functionality of in the admin system via Configuration &...
8
votes
4answers
14k views

How to update product custom options on Cart Page?

I have a simple product with custom options. When someone select any option and click on add to cart the product with the option goes to the cart where the product and selected option is shown. Now ...
8
votes
4answers
4k views

“Stop Further Rules Processing” not applying to all items

There appears to be a bug with "Stop Further Rules Processing" in Magento CE1.9 / EE1.13 where only the first item in your cart recieves the discount. I would expect: If I have multiple shopping cart ...
8
votes
2answers
3k views

How to remove the old cart product after customer login

Customer visit website and add the product, then customer login. if customer already have cart items, its removed old items, newly added items only showing Example: Customer already have 5 ...
8
votes
2answers
6k views

Modifying custom options of an item when adding it to the cart?

I am listening to the sales_quote_save_before event to notice when an item is added to the cart. Once its fired, I iterate through the items options like this: $quote = $observer->getEvent()->...
8
votes
3answers
159 views

Getting Value of product attribute on cart page even not assigned to that particular product Magento 2

I am getting the product attribute from quote. It seems there is wrong value comes. Please check my below code. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $...
8
votes
3answers
4k views

Mini-Cart displaying Parent Product Image instead of Product Image

I've got code that will display a product in the mini-cart using ajax, when a customer clicks on Add to Cart. The issue is that it is not displaying the child product image until I do a refresh of ...
8
votes
1answer
592 views

Please specify the product's required option(s) Custom Option type file

I got only one custom option, which is file type, I tried to add product to cart programmatically like this: $logoSku = 'lg-brnd01'; $productLogo = Mage::getModel('catalog/product')->...
7
votes
5answers
27k views

programmatically adding product to cart returns empty price

i have been trying to programmatically add a product to cart using following lines of code, it seems to work and successfully adds product but for some reason, the price of newly added product always ...
7
votes
3answers
10k views

Is it possible to share the cart contents between multi-store websites?

I have a client who needs a multi-store setup. They require the contents of the cart to be shared between websites. Also when the customer switches between websites, the cart item(s) price may be ...
7
votes
1answer
15k views

Get Shipping Price From Quote

I am trying to get the shipping price from the quote on the cart page for the entire order. I have tried multiple things including: Mage::getModel("checkout/session")->getQuote()->...
7
votes
2answers
5k views

How to add “Buy Now” button in Magento 2.1? [closed]

I need help to add "Buy Now" button on the product detail page. Thanks.
7
votes
2answers
9k views

Magento 2 - Set custom attribute value on cart page

In Magento 1.x I have created following function in Namespace/Modulename/Model/Observer.php public function salesQuoteItemSetCustomAttribute($observer){ $quoteItem = $observer->...
7
votes
4answers
16k views

Grand total without tax

i want and need in cart display Grand Total price without include tax, but tax price should be display in different line. How i can do this? where i can modify file? Thanks
7
votes
3answers
9k views

Persistent shopping cart works even if disabled

In the backend, I have got "Enable Persistence" set to "No". Still, If I use one browser to add something to cart, I can see that in the second browser after page reload. How can this work if ...
7
votes
3answers
2k views

How to remove Guam, Palau, and other US Territories from address State dropdown - Magento 2 [duplicate]

How can I remove Guam, Puerto Rico, Palau, and all other US Territories from the "State" (or "Region") dropdown list on both the cart page and checkout pages? I only want to ship to the 48 contiguous ...
7
votes
2answers
5k views

How to create a shopping cart rule - Get an certain item free if you spend over $50

How do I create a shopping cart rule where you get an item free if you spend over $50? I do not want to download any extensions, I just need to know how to make a certain item free when customers ...
7
votes
1answer
2k views

Order totals showing wrong way around

How can I change the position of the order totals (incl. tax / excl. tax) in the tax calculation? As it should show the total including tax below the total excluding tax but at the moment it does not.
7
votes
2answers
1k views

Magento 2 - Generate customization image in product page and add it to product options in cart

I need to let users create a customization image in product page and than attach that image to product when users add product in cart. Create a custom product option type seems to be very tricky. I ...
7
votes
1answer
1k views

Cart sidebar on checkout load dynamic

I use a cart in the sidebar of the one page checkout. This display the products and the total price of the cart. But I also use some additional cost for payment, so it needs to load dynamically, so ...
7
votes
3answers
11k views

Add product to cart with custom option using PHP

I am trying to add a product to the cart programmatically with some custom options. The item gets added to the cart correctly but none of the options ever get added. My code is: require_once '../../...