Skip to main content
38 votes

Magento 2 - How to get all items in cart?

I'll answer the question in two parts: I. Where should you change the checkout URL? The destination in link.phtml is $block->getCheckoutUrl(). You should not change the template to change ...
Fabian Schmengler's user avatar
32 votes

Magento 2 - How to get all items in cart?

The use of Magento\Checkout\Model\Cart is deprecated. You should use the session to get the quote and your cart items. use Magento\Checkout\Model\Session; public function __construct( ... ...
Frank's user avatar
  • 1,144
20 votes

Magento 2 - How to get all items in cart?

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); // retrieve quote items collection $itemsCollection = $cart->...
Rahul Katoch's user avatar
  • 1,119
6 votes

Magento 2 change number of items per row

You can find below css styles in [Magento Blank Theme directory]/Magento_Catalog/web/css/source/module/_listings.less line 290 - 295 .products-grid .product-item { width: 100%/3 } .page-layout-...
skynetch's user avatar
  • 1,662
6 votes
Accepted

Change <item> node class via di.xml

Let's say you want to change the links one. You have to create your own module that depends on the Magento_Downloadable module and add this in the di.xml of your module. <type name="Magento\...
Marius's user avatar
  • 198k
6 votes
Accepted

Magento 2 - How to programmatically add a product to cart multiple times but with different options?

Somewhere in Magento 2 code is the answer : /** * We need to reload product in this place, because products * with the same id may have different sets of order attributes. */ It means that when I ...
DependencyHell's user avatar
5 votes
Accepted

What is Difference Between Field, Argument and Item in Magento 2

First check the example, I give you understanding by an example. <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/...
Muhammad Hasham's user avatar
5 votes
Accepted

Hide item count and pagination from category page in Magento2

This is one way to hide limiter and count from listing Page, there can be others as well Update your extended toolbar.phtml file and Find it at your extended theme path or if not then copy from ...
Manoj Deswal's user avatar
  • 5,805
4 votes
Accepted

Get Order Id from Order Item id in Magento 2

There is no direct way to load Order Object using Order Item Id. But if you Load Order Item Object using Item Id then you can directly get the Order Object using function getOrder you can check ...
Pankaj Pareek's user avatar
4 votes

Magento 2 get shipped items in sales_order_shipment_save_after event

class ProcessShipment implements ObserverInterface { /** * @var eventManager */ protected $_eventManager; /** * @var ObjectManagerInterface */ protected $...
Chandresh P.'s user avatar
3 votes

Magento 2 - How to get all items in cart?

Like @Frank says Magento\Checkout\Model\Cart was deprecated in version 100.1.0 Another option is to use a Proxy and benefit from the performance optimization Here is how: public function __construct(...
diazwatson's user avatar
  • 2,440
3 votes
Accepted

Magento 2 : Adding Custom Attribute "color" to Order Items in Backend

Item object has a product property that you can retrieve by `$product = $_item->getProduct(); $color = $product->getData('color'); Make sure that $_item is instance of Magento\...
Abhishek Jakhotiya's user avatar
2 votes

Magento : Update Cart Grand Total and Subtotal

Please reconsider your logic. From a customer point of view, it is not a best practice to display a Grand Total value other than the total price of items in cart. Or you can use the Bundle Item ...
Deepak Karunakaran's user avatar
2 votes
Accepted

Delete order item after successfully save order Magento 2

Please try the below code and keep in the observer <?php namespace Namespace\Module\Observer; use Magento\Framework\Event\ObserverInterface; use Magento\Framework\App\...
Nagaraju Kasa's user avatar
2 votes
Accepted

How to filter items by id in Magento 2

In fact, the clean way exists : $_item = $order->getItemById($_item_id);
Alexglvr's user avatar
  • 1,675
2 votes
Accepted

how to get Grand Total of Wishlish Items in magento?

You can achieve this by updating following file. app\design\frontend\YOUR_PACKAGE\YOUR_THEME\template\wishlist\item\list.phtml replace your file code with below. <?php $columns = $this->...
Jaimin Sutariya's user avatar
2 votes
Accepted

Magento 2: Retrieve items on Order

Inject \Magento\Sales\Model\Order class to get order items protected $order; public function __construct( ... \Magento\Sales\Model\Order $order, ... ) { ... $this->order = $...
Prince Patel's user avatar
  • 22.8k
2 votes
Accepted

Get Order Id from Item Id in magento 1

You can do it by magento way: $orderItem = Mage::getModel('sales/order_item')->load(259283); echo $orderItem->getOrderId();
Nikunj Vadariya's user avatar
2 votes
Accepted

Magento 2: How to get Order Item's Direct Without Inner Loop

Add following code into your order collection $orderCollection->getSelect() ->join( 'sales_order_item', 'main_table.entity_id = ...
Sohel Rana's user avatar
  • 35.9k
2 votes
Accepted

How to add item status for an order in magento 2

You can get the status of each individual item using the following: foreach ($_order->getAllItems() as $item) { echo $item->getStatus(); }
AJK's user avatar
  • 751
1 vote

Magento 2.2.10 is it possible to get all the orders status is pending?

You can use this <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $pendingOrdersCollection = $objectManager->get("\Magento\Sales\Model\Order")->getCollection()-&...
Kishan Savaliya's user avatar
1 vote

Item is out of stock but available on storefront

1.On admin page, Click on Stores, then under the Setting section, choose Configuration. 2.In this page, you find the Inventory section under Catalog. Expand the Stock Options section and you can ...
Rakesh Donga's user avatar
  • 5,364
1 vote

How to display wishlist item details in admin panel of magento?

Use this code : $wishlist = Mage::getModel('wishlist/wishlist'); $wishlistCollection = $wishlist->getCollection(); $select = $wishlistCollection->getSelect(); $select->join(array("t1" =...
Padhiyar Gaurang's user avatar
1 vote
Accepted

How to open my wishlist top link in new window?

1) To customise wish list from Top links (open it in a new window): The best way is to do it via xml. Go to app/design/frontend/{package}/{theme}/layout/local.xml then add this code before </...
PЯINCƎ's user avatar
  • 11.7k
1 vote
Accepted

Magento 1.9.3.2 edit table /email/order/items.phtml - Solved

Solved @versedi thanks My extension OneStepCheckout rewrote the core base
Pako's user avatar
  • 75
1 vote

Magento 2 : What is the Best Way to Implement Favorite Products List for Regular Customer?

It's very old question, but sadly noone answered it. I bet the author has more knowledge now, so he could answer it himself now :) Nevertheless, your question was theoretical, so I won't provide the ...
dudzio's user avatar
  • 620
1 vote

How can I get additional data for each order item, based on order id?

You can use this code to get orders items in observer: Magento 2 $orderId = ''; $order = $this->_objectManager->create('Magento\Sales\Model\Order')->load($orderId); $orderItems = $order->getAllItems()...
Pankaj Sharma's user avatar
1 vote

Magento add another custom dropdown field in bundle items of bundle product

In order to create new dropdown field next to position, we will create new module for it or add code in any of your custom module. Do whatever is easy for you. Here our field name is "is fixed bundle" ...
InfoBeans's user avatar
  • 332
1 vote

Get name for all products of all orders

You can use the next variant: /** @var Mage_Sales_Model_Mysql4_Order_Collection $_orders */ $_orders = Mage::getModel('sales/order')->getCollection(); // replace with yours $this->getOrders(); /...
Siarhey Uchukhlebau's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible