Magento 2 API: Add Products to Cart & Checkout Place Order

In this article, we will look into how we can add products to the cart and complete the checkout process by placing an order using Magento API. The APIs used to create a cart, add products to the cart, place an order, etc. require customer token authentication. Create Shopping Cart We create an empty cart … Read more

Magento 2: Get all shopping cart items, subtotal, grand total, billing & shipping address

This article shows how to get shopping cart items/products, subtotal and grand total of cart, and shipping and billing address entered while doing checkout in Magento 2. I will be using both Dependency Injection (DI) and Object Manager in the below example code. Using Object Manager – Get products id, name, price, quantity, etc. present … Read more

Magento: Redirecting to Cart page from Checkout page after Place Order

Scenario: I added products to cart. Then did proceed to checkout. I have tried Cash on Delivery and Check / Money Order as Payment method. Everything is fine until the order review section. And then when I click the Place Order button then it gets redirected to Cart page instead of going to Order Success … Read more

Quick Order – Add to Cart by SKU: Magento Extension [FREE]

Quick Order – Add to Cart by SKU is a FREE Magento Extension that allows customers to directly add products to shopping cart using product SKU. This module is compatible with Magento version 1.5 and later (Magento 1.5, 1.6, 1.7, 1.8, 1.9). A Quick Order block will be displayed in left and right sidebar. This … Read more

Magento: Clear / Delete Shopping Cart Items of Single or All Customers

Here is the code to delete all shopping cart items of currently logged in single customer: $cart = Mage::getSingleton('checkout/cart'); $quoteItems = Mage::getSingleton('checkout/session') ->getQuote() ->getItemsCollection(); foreach( $quoteItems as $item ){ $cart->removeItem( $item->getId() ); } $cart->save(); If you want to clear all shopping cart items of all customers then you can use the following code: $quoteCollection = … Read more

Magento: Get Add to Cart URL of any Product

Here is a quick code to get add to cart url of any product. Suppose that we are fetching add to cart url of a product with id ‘166’. $_productId = '166'; $_product = Mage::getModel('catalog/product')->load($_productId); $_url = Mage::helper('checkout/cart')->getAddUrl($_product); Hope it helps. Thanks.