Questions tagged [cart]
Question related to the shopping cart: adding/removing products, shoping cart price rules, the appearance of the shopping cart page.
2,229
questions
45
votes
5
answers
121k
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
7
answers
15k
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
4
answers
20k
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 ...
32
votes
2
answers
5k
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?
30
votes
6
answers
42k
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 ...
30
votes
5
answers
103k
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.
27
votes
9
answers
31k
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 ...
18
votes
6
answers
9k
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
4
answers
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
6
answers
17k
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
2
answers
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
2
answers
2k
views
Magento 1 - 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
4
answers
5k
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
2
answers
2k
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
3
answers
3k
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
1
answer
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)
...
13
votes
5
answers
23k
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 ...
13
votes
3
answers
40k
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 ...
13
votes
1
answer
3k
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 ...
12
votes
2
answers
18k
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
5
answers
17k
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
2
answers
2k
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
4
answers
24k
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->...
11
votes
1
answer
2k
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
2
answers
25k
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 ...
10
votes
3
answers
16k
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 ...
10
votes
1
answer
311
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 ...
9
votes
1
answer
19k
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()->...
9
votes
6
answers
2k
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
1
answer
3k
views
Role of is_active in sales_flat_quote?
Can anyone shade some light on the real usage of is_active field in sales_flat_quote table?
AFAIK, is_active field is used in the following cases:
is_active is always 1 for cart/quote created by web ...
8
votes
2
answers
12k
views
Disable entire cart functionality & checkout in Magento 2
From the admin side I can disable the one step checkout, but still users can add products to the cart. I want to display only products without checkout.
Is there any extension there?
I mean disable ...
8
votes
3
answers
5k
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 ...
8
votes
1
answer
21k
views
Magento 2 - How to add custom discount in cart programmatically?
I want to apply custom discount amount to cart programmatically. I have tried doing it in following 2 ways, none of which work:
METHOD 1:
I tried following the default way in which Magento2 applies ...
8
votes
3
answers
16k
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
4
answers
15k
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
5
answers
5k
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
2
answers
4k
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
2
answers
8k
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
3
answers
718
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
3
answers
5k
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
1
answer
2k
views
Difference between Minicart and Cart in Magento 2
I want to know the difference between Mini cart and Cart in details.
8
votes
2
answers
7k
views
Magento 2 No such entity with cartid =
I'm experiencing this error on my site quite often:
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): No such entity with cartId =
It's not using multiple stores, so the entity_ids ...
8
votes
1
answer
942
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
5
answers
28k
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
4
answers
10k
views
How to override module-checkout/.../cart/item/default.phtml?
I want to customize the cart page. I'm trying to override it using module. I created module which is working fine.
I created layout:
checkout_cart_item_renderers.xml
<?xml version="1.0"?> &...
7
votes
2
answers
4k
views
Cart Summary expanded
On our checkout page we have the product list and the shipping options within a collapsible menu.
I can not seem to get it expanded. I found the relevant passage in the _cart.less.
Is anyone able to ...
7
votes
1
answer
8k
views
How do I load JavaScript function inside KnockoutJS html?
I am making changes to my Magento 2 cart.
I want to run a particular JavaScript function once the registration.html file is loaded
My file:
/app/design/frontend/mytheme/default/Magento_Checkout/...
7
votes
3
answers
14k
views
magento 2 order confirmation email sending before payment gatway redirection
I am new to magento2 and developing a custom payment module for ccavenue.I am facing a problem regarding order confirmation email.
The order confirmation email is sending once the customer ...
7
votes
3
answers
12k
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
3
answers
30k
views
remove items from cart in controller - magento2
I need to remove all the items from cart, below method remove the items in chenckout/cart/index page but header minicart section still dispaly the items even after refresh page too.
I have try this ...