How to get selected shipping method in magento

Magento 1 :

Magento 2 : You can do this by calling the \Magento\Checkout\Model\Session. Add it to your constructor and get it by using this code :

Or you can get by Object Manager Instance by using this code :

Thank for reading this post, Hope it helps.

Read More >

How to change product price by code for magento

Magento 1 : The code for change price of product, you can put on controller, model, helper or any where

Magento 2 : To change price of product you need to follow these functions:

Thank for reading this post, Hope it helps.

Read More >

How to count sale product in Magento 1

– If you want to show stock sold on the product page for the entire duration the product has been active, try this code:

– If you want to how many have been sold of the product for today, try this code:

– If you want to have it so that it only […]

Read More >

How to call static block any page in Magento 2

– If you want to call static block in cms page:

– If you want to call in phtml file :

– Your xml file code should be :

Read More >

[Solved] add product in cart using ajax in Magento 2

If you want to add product in minicart Magento 2 with Ajax, follow below way: – Open addtocart.phtml file in your theme directory: app/design/frontend///Magento_Catalog/templates/product/view – Modify the bindSubmit function

Read More >

How to clear items in cart magento 1&2

Magento 1 : The code for delete shopping cart items for logged in customer:

The code for delete shopping cart items for all customers:

If you have a large number of customers quotes then deleting them by using loop might be time and resource consuming. You can clear/delete all customers cart items (all […]

Read More >