Questions tagged [quoteitem]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

Magento 2: How to decrements item qty?

I want to decrements item qty programmatically. $item = $this->cart->getQuote()->getItemById($itemId); $qty = $item->getQty(); if($qty > 0) { $newqty = ($qty - 1); ...
0
votes
0answers
32 views

Magento 2 Add extension attributes in Quote Item

I want to add custom attribute in quote items Magento\Quote\Api\Data\CartItemExtensionInterface <extension_attributes for="Magento\Quote\Api\Data\CartItemExtensionInterface"> <attribute ...
0
votes
2answers
100 views

Magento 2 Unable to set custom Price in cart item by API

I'm trying to add an item by API.every thing are working except item price It's Magento Bug that not take price from API https://devdocs.magento.com/redoc/2.3/admin-rest-api.html#operation/...
0
votes
0answers
69 views

Apply discount amount on cart line items in Magento 2

I am trying to set discount amount on each cart item in the cart with some condition. I have followed like this to achieve that. Vendor/Module/etc/sales.xml <config xmlns:xsi="http://www.w3.org/...
0
votes
2answers
70 views

Item not deleting from quote in Magento2

I have used observer to delete the quote item. Used this event controller_action_predispatch_checkout_index_index This is the code of my etc/events.xml. <event name="...
2
votes
1answer
29 views

How to get product price from \Magento\Quote\Model\Cart\Totals\Item $item

I need to get the product price from \Magento\Quote\Model\Cart\Totals\Item $item. I tried this but it doesn't work /** @var \Magento\Quote\Model\Cart\Totals\Item $item */ $item->getProduct()-&...
0
votes
0answers
17 views

Get custom attribute from product in ToOrderItem convert method

I'm implementing a plugin for Magento\Quote\Model\Quote\Item\ToOrderItem public function aroundConvert(\Magento\Quote\Model\Quote\Item\ToOrderItem $subject, \Closure $proceed, \...
0
votes
2answers
50 views

Get data from Quote_items table in Magento 2

I am new to Magento 2 so I do not understand much about select data from the table in Localhost also which file I need to create I want to display data from Quote_item table in the .phtml file, and ...
2
votes
0answers
11 views

Why cart ID is null even though i can see the id from \Magento\Checkout\Helper\Cart

I am trying to get the cart value, i can get the quote id when i do x-debug. if i try to get the id i get NULL Anyone know why i get this
2
votes
3answers
45 views

Display data from Quote_item error

I have tried to display the data from Quote_item table in the database to file .phtml but it shows this error the code in Magento/MyHistory/Block/View.php <?php namespace Magento\History\Block;...
5
votes
2answers
81 views

How to Delete Quote item Based on the condition in magento 2

I have requirement like below. I need to read all quote items and their sku, against the custom table, If value matched, need to delete that quote item and update qty 1 for remaining items but this ...
0
votes
1answer
99 views

How to update custom column value in quote_item table magento 2

Actually i created custom column in quote_item and trying to update the value once product added to the cart programmatically magento2 custom module using Model. If Anyone have idea please ...
0
votes
1answer
20 views

Update all quote items with qty 1 in magento2

I am trying to update all the quote item qty as soon as we navigated to the cart page. by using below code. $quote = $this->checkoutSession->getQuote(); $quoteItems = $quote->...
1
vote
0answers
61 views

Why V1/guest-carts/{cart-Id}/ PUT api is not move guest cart item to customer cart in magento-2.2.7?

I want to move guest cart item into customer cart by using this [PUT] /V1/guest-carts/{cart-Id}/ . But it give {"message": "Cannot assign customer to the given cart. You don't have permission for ...
0
votes
1answer
36 views

Quote Item level manual Discount - Magento 2

I need to give Quote Item level manual Discount for selected cart items. After giving discount Cart Item row total will change. As can't modify the product price so custom price solution is also not ...
0
votes
1answer
11 views

How can I get all data from cart

Is it possible to get check if cart has any product been added in. I want to check if a product been added to the cart in a phtml page. If the user click the page I want to show how many product they ...
0
votes
1answer
17 views

How to get quote details in helper

I want to see if there is anything exists in the cart if I am in a phtml page I have tried to use session and cart but I am getting null When I tried to use session I wasn’t sure how to get the ...
1
vote
3answers
51 views

Magento 2 get custom product attribute

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Catalog\Model\Product')->load('YOUR PRODUCT ID'); echo $product->getAttributeText(...
1
vote
1answer
51 views

How to delete cart Item by SKU or productId in magento 2

I have retrieving all cart items and deleting the quote item by match with the product Sku, Here is my code. protected $checkoutSession; protected $_itemModel; protected $cart; public function ...
2
votes
0answers
24 views

Add css class to item on checkout xml

how can i add a css class eg.: class="myClass" to an item on checkout xml? for example <item name="after-place-agreements" xsi:type="array"> <item name="component" xsi:type="string">...
0
votes
2answers
64 views

Get Quote Item from Product Id

I am trying to get the Lastly added Quote Item using "checkout/session". By I don't know, how to get the last added Item. Hence I have product_id. I believe instead of loading the collection and all,...
0
votes
0answers
12 views

Edit quote qty but price incorrect for mutiple products

I would like to update quote from a order. When I update qty of a item from quotes it make correct subtotal and tax. However, when I update great than 2 items then subtotal and tax get last data ...
0
votes
0answers
30 views

Magento 2 - Add new quote item when quantity changed to > 1

I wanted to add new quote item (new row on cart page) when the product quantity is more than 1. I already tried accepted answer provided here. Whenever I tried to add existing cart item from 'product-...
0
votes
1answer
106 views

Fatal Error: 'Uncaught Error: Call to a member function setCustomPrice() on boolean magento 2.3

Here i am trying to add product to the cart using customerId and productId without customer logged in, it's working fine but its not adding custom Price to that product,please guide me if you have ...
0
votes
0answers
33 views

How to add product to the cart with customer id and product id magento 2.3?

Actually while adding product to the cart with product id and customer id, i am facing one error "We found an invalid request for adding product to quote." If anyone have any idea please guide me. &...
1
vote
1answer
171 views

Magento 2: How to set item Row total?

I want to set a custom row total. I am using 'checkout_cart_product_add_after' event. And want to update Row total. I going to add an extra amount in an item row total. like, $item->setRowTotal($...
0
votes
2answers
56 views

How to get value from sales_flat_order_item table using quote_item_id?

Using the sales_order_place_after event in my custom Observer. I have the quote_item_id value (example 324). How to get the corresponding item_id value from the sales_flat_order_item table? I am ...
0
votes
1answer
42 views

Magnto 2 update the cart custom option value

Currently am using magento 2.2.5, while adding the product to the cart the custom options values are stored in the quote_item_option table correctly. while updating the custom options ...
4
votes
1answer
298 views

Update quote item price without using custom price

We are developing a custom module which applies custom tier prices by product category. Our solution works on frontend checkout so far and consists of observing the sales_quote_item_set_product event ...
3
votes
1answer
101 views

Overriding Quote Item Weight Programatically

My goal is to alter the weight of a product based on a chosen custom option. I have the custom option part working, but am unable to alter the weight of the item is such a way that affects the ...
1
vote
2answers
191 views

Magento 2: save item options in quote(quote_item_option)

I need to add new option for item. Now in quote_item_option i have: {"id":"54","product":"54","selected_configurable_option":"","related_product":"","options":{"4":""},"qty":"1"} But wanna {"id":"...
0
votes
0answers
19 views

Apply different shipping methods to each item in cart and get total shipping amount in magento 2

I am facing problem in applying different shipping methods to each item in the cart and then getting total shipping amount for the quote in Magento 2. Can anyone help me with this? Any help would be ...
0
votes
1answer
99 views

Programmatically creating an order: How to add custom options to products in quote?

I'm trying to create an order programmatically. With simple products without custom options it already works like a charm. But when I try to add custom options I get the very specific error: We ...
0
votes
0answers
54 views

How to update product quantity in cart by custom field

I added some custom field(receipent_email) in quote_item table. When user adding item in cart, I m sending custom data to cart item. Data is saving in quote_item table perfectly. Also i split item ...
2
votes
2answers
245 views

getItemById($itemId) for Magento Quote Model not working as expected in Magento 2

Here is my code, where I'm calling Quote model file and getItemById function. public function __construct( \Magento\Quote\Model\Quote $quote ) { $this->quote = $quote; } ...
0
votes
1answer
33 views

Magento2: I want to get customer cart item collection without customer login

How to get customer cart item collection without customer login? I want to also get cart item through item id. Got the null value <?php namespace vendor\module_name\Block\Index; class ...
0
votes
3answers
835 views

Magento2: How to get quote item through item id?

I want to get quote item through the item id on the guest page. Got the null value <?php namespace Codism\Csr\Block\Index; class Approveitem extends \Magento\Framework\View\Element\Template { ...
0
votes
2answers
63 views

Get orderId from quote_item

I have an instance of \Magento\Quote\Model\Quote\Item $item I need to get the order ID of the order in which that particular item has been purchased. For full disclosure, I am using a plugin ...
0
votes
1answer
630 views

How to set additional data to quote_item table from controller in Magento 2?

I have a controller with following code $data = $this->getRequest()->getPostValue(); $item_id = $data['item_id']; $additionalOptions = $data['additional_options']; $itemFactory = $...
0
votes
0answers
93 views

Magento2: Issue in saving custom option to quote

I am saving custom options to the quote programmatically. But custom options are not visible in the backend. On debugging I found that in quote_item _option table rows are missing, entry corresponding ...
2
votes
2answers
2k views

Magento 2 Custom remove item from cart button

I am trying to create a custom button to remove items from the shopping cart. I've tried the following code <a href="<?php echo $this->getUrl('checkout/cart/delete', array('id' => $this-&...
1
vote
1answer
146 views

Magento 2, how to get list of product by item_id?

Using Magento 2.2, REST API. What URI of api for get list of product by item_id? This below get all item without defined item_id GET /index.php/rest/V1/carts/mine/items HTTP/1.1 Content-Type: ...
1
vote
1answer
280 views

get Quote Item ID from event checkout_cart_product_add_after not working

I'm adding product to cart programatically in magento 2 $this->cart->addProduct($product, ['product' => $product->getId(), 'qty' => '1']); I want to get quote item_id using event ...
4
votes
4answers
4k views

Get quote item collection by using quote item id in Magento 2

I get the quote_item_id like this: $orderItems = $order->getAllItems(); foreach($orderItems as $orderItem){ $qouteItemId = $orderItem->getQuoteItemId(); } I need to load quote item ...
0
votes
1answer
592 views

How to load a quote item via it's id?

Is there a way to load a quote_item directly using current Magento coding standards? Right now I'm loading the cart and then finding the quote item like so: $cart_id = $this->getRequest()->...
0
votes
1answer
288 views

Removing items from quote depending on custom condition

I am trying to use sales_quote_item_collection_products_after_load to remove items from a quote depending on a custom condition. public function filterQuote(Varien_Event_Observer $observer) { /** @...
1
vote
2answers
675 views

Magento2 - duplicate quote item to new row and new price

Is it possible to add the same product (with same configurable options) with different price based on some custom values present in the product page to the shopping cart, but have it appear as ...
1
vote
2answers
1k views

How to clear item in cart in frontend web page programmatically?

Using magento 2.2, I need to remove all items in current cart while going to other root category on my front page. I want some advice for coding this event.
2
votes
1answer
26 views

Product is missing Attibute Text property

I have the following in my custom module: $product = $quote_item->getProduct(); If I then do this I see the product id: var_dump($product->getId()); This though gives me null: var_dump($...
0
votes
0answers
226 views

Magento 2 - Save value from custom input field to quote_item

I have created an extra field Delivery in quote_item, I have also created a input field that customers can type in the delivery date they wished, on product page. How can I save the value from this ...