How to Get Selected Shipping Rate in Magento 2 Checkout Page

How to Get Selected Shipping Rate in Magento 2 Checkout Page

Store owners implement various pricing strategies like offering discounts, coupon codes, or even have a system of store credits in order to manage refunds.

Also, sometimes, the customers are eligible for tax exemption such as VAT exemption.

In all these scenarios, the online store owner needs to calculate the exemption on the order total.

For Magento 2 store owners, if one wants to implement this exemption on subtotal and shipping rates, one needs to get selected shipping rate in Magento 2 checkout page.

The programmatic method to do is shown below using which you can get the selected shipping rate on the checkout page and use it to calculate the exemption for discounts or store credits on order total..

Method to Get Selected Shipping Rate in Magento 2 Checkout Page:

Use the below code in your block file:

That’s it

If you have any doubts regarding this post, just mention them in the Comments section below.

I would be happy to help.

Feel free to share the solution with Magento Community via social media.

Thank You.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

5
(based on 10 Reviews)

Kanchi is a Magento Developer at Meetanshi. Apart from that, she is into dancing. In her free time, she likes to make handmade art and craft.

Leave a reply:

Your email address will not be published.