How to Get Active Shipping Methods based on Quote ID in Magento 2?

 <?php

namespace  Vendor\Extension\Helper;


class Data extends \Magento\Framework\App\Helper\AbstractHelper

{

    public function __construct(

        Context $context,

        \Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethod)

    {

        $this->shippingMethod = $shippingMethod;

        parent::__construct($context);

    }


    public function getShippingMethod($quoteId){

        $shippinigData = $this->shippingMethod->getList($quoteId);

        $shippingMethod = [];

        foreach($shippinigData as $shipping)

        {

            $shippingMethod [] = $shipping-> getMethodTitle();

        }

        return  $shippingMethod ;

    }

}

Comments

Popular posts from this blog

Add Admin User name and Action name in Order Comment Section through Action Performed from Sales Order Grid in Magento 2

How to Update Product Stock Programmatically in Magento 2

How to Set and Get Cookie in Magento 2