Skip to main content
31 votes
Accepted

Magento 2 make product attribute available in QuoteItem

In order to make custom product attribute available in quote item, simply add the attribute in the file: Vendor/Module/etc/catalog_attributes.xml <?xml version="1.0"?> <config xmlns:xsi="...
MagePsycho's user avatar
  • 4,628
22 votes

Magento 2 Add dropdown list to shipping method

Magento checkout does not support any kind of form for shipping method additional data. But it provides shippingAdditional block in the checkout which can be used for this. The following solution will ...
Zefiryn's user avatar
  • 5,908
19 votes

Magento 2 additional data to shipping method

The top-rated answer doesn't work because he forgot to set the "description" value inside of the \Magento\Quote\Model\Quote\Address\Rate class. If we do not create a Plugin to set the ...
Andresa Martins's user avatar
18 votes
Accepted

Magento 2 add custom extesion html file in shipping method block

I am not sure if you can achieve that. Table with carrier rates is rendered based on rest request to rest/en/V1/guest-carts/estimate-shipping-methods. You need to add extension attributes to ...
Zefiryn's user avatar
  • 5,908
16 votes
Accepted

Magento2: How to get shipping method in order using observer `sales_order_save_after`?

You can get the shipping method by $order->getShippingMethod(); or $order->getShippingAddress()->getShippingMethod();
MeenakshiSundaram R's user avatar
15 votes

Magento 2 How to get all active shipping methods?

Or you can use \Magento\Shipping\Model\Config\Source\Allmethods, it does just that!
sparrow's user avatar
  • 171
11 votes

Magento 2 - enable cash on delivery only for specific shipment method

I use an plugin in a custom module to set the isAvailable() function for Magento\OfflinePayments\Model\Cashondelivery to false when shipping method flatrate_flatrate is selected. file: <magento-...
juhanix's user avatar
  • 671
11 votes

Get Product Attribute value

$_product = $block->getProduct(); $myattribute = $_product->getResource()->getAttribute('Your_Attribute_Code')->getFrontend()->getValue($_product); echo $myattribute; if want to show ...
Tanzirul Islam's user avatar
11 votes
Accepted

What is the current UPS shipping gateway? (outage 2019-01-06)

You simply need to update the UPS Gateway URL to use "https" To change this setting, login to the backend of your Magento website and then go to : System > Configuration Click “Shipping Methods” ...
Adam Hodson's user avatar
10 votes
Accepted

Add shipping method programmaticaly

Need to add following dependency in constructor: \Magento\Quote\Model\Quote\Address\Rate $shippingRate and then use the following code: $quote=$this->quote->create(); //Create object of ...
Hassan Ali Shahzad's user avatar
9 votes

Magento 2: Hide other shipping methods when free shipping is available

Use the extension ShippingTweaks.
Vitalii's user avatar
  • 608
9 votes
Accepted

Magento 2 How to remove shipping method in checkout page

Follow below steps: Vendor: Vendor ModuleName: CheckoutStep 1) Override checkout_index_index.xml in your module and define your own component in shipping step app/code/Vendor/CheckoutStep/view/...
Prince Patel's user avatar
  • 22.8k
8 votes

Magento 2 additional data to shipping method

You need to do this by adding description as an extension attribute as below: /etc/extension_attributes.xml should be like this: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/...
VIPIN A ROY's user avatar
8 votes
Accepted

Magento 2 How to get all active shipping methods?

In addition to answer of keyur shah You can get all active shipping using below code: protected $scopeConfig; protected $shipconfig; public function __construct( \Magento\Framework\App\Config\...
Prashant Valanda's user avatar
8 votes

CollectRates in custom carrier is not called when weight is over zero. Magento2

I have got the solution, this is because we need to define processAdditionalValidation method inside the carrier class and for checking the result you can return true in this function. public ...
Neeraj Garg's user avatar
8 votes
Accepted

magento 2: Hide shipping method in frontend

You can disable/hide Flatrate shipping method at frontend in magento 2 using plugin concept. please follow the below steps Create custom module Hello_World Create plugin and configure in di.xml file, ...
Nagaraju Kasa's user avatar
8 votes
Accepted

Magento 2 checkout - Update shipping methods after change of city, address line and telephone fields

After so much investigation I found one solution. I have tried for Offline shipping methods as described follows and its working fine for me: Namespace/Module/view/frontend/requirejs-config.js var ...
Dhara Bhatti's user avatar
8 votes
Accepted

How to properly get current quote in Carrier Collect Rates function?

You can not directly get quote in collect rate. The $this->checkoutSession->getQuote() will call your collectRates function at the end, so you will end up getting infinite loop. the $request ...
Shoaib Munir's user avatar
  • 9,522
7 votes

Magento2: How to get shipping method in order using observer `sales_order_save_after`?

$order->getShippingDescription(); // returns Shipping Method Title
Nitesh Kuyate's user avatar
7 votes
Accepted

Magento 2 custom shpping method not showing on frontend

This worked out for me https://github.com/mageplaza/magento-2-shipping-method/issues/1 => Changing "enable" for "active" in: /app/code/Mageplaza/Simpleshipping/Model/Carrier/Shipping.php 53 /...
acampos's user avatar
  • 96
7 votes
Accepted

Magento2 how to get current address data in custom shipping method

If you open this class you can able to see some getter/setter for address. So inside shipping method you have RateRequest $request object. You can access this by following way: $request->...
Sohel Rana's user avatar
7 votes
Accepted

Hide Shipping Method Title from Order Summary

Please override your file vendor/magento/module-checkout/view/frontend/web/js/view/summary/shipping.js to /app/design/frontend/Vendor/ThemeName/Magento_Checkout/web/js/view/summary/shipping.js ...
mohit vamja's user avatar
6 votes

Magento 2: Hide other shipping methods when free shipping is available

Write a plugin to disable flat rate shipping method when free shipping is actually enabled based on cart sub total. <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
Maniprakash Chinnasamy's user avatar
6 votes
Accepted

Magento 2: Hide other shipping methods when free shipping is available

I had the same problem. Remove "Free Shipping" configuration because you don't need it (you already have "Cart Price Rules"). When your customer qualifies for free shipping it happens based on "Flat ...
Gabriel Silva's user avatar
6 votes
Accepted

Magento 2 - Shipping fee using table rates always zero when adding more items in cart

As per magento default, table rates are working but also some cart rule is applying on shipping rates. For Example when you add one product add to cart, table rates are working but when you add ...
Suresh Chikani's user avatar
6 votes

Magento 2 How to get all active shipping methods?

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $activeShipping = $objectManager->create('Magento\Shipping\Model\Config') ->getActiveCarriers(); Note: I am ...
Keyur Shah's user avatar
  • 18.1k
6 votes
Accepted

Magento 2: Send different email templates for Ship, based on Shipping Method chosen

You can create some variables to use in the email template to add some messages based on the shipping method. Add the variables to the template by creating a plugin for Magento\Sales\Model\Order\...
Aaron Allen's user avatar
  • 9,009
6 votes

Shipping Method list by group at checkout page

overirde the the below file in theme or custom module vendor/magento/module-checkout/view/frontend/web/template/shipping.html vendor/magento/module-checkout/view/frontend/web/js/view/shipping....
Parth Shah's user avatar
6 votes
Accepted

Remove specific shipping method based on condition in magento 2

I am able to resolve this error like below. Added id for each tr that is, each shipping rates. <tr class="row" data-bind="attr: { ...
Jafar Pinjar's user avatar
  • 1,949
6 votes
Accepted

Magento 2: Add active class on selected shipping method

You can add below JS code in your checkout page for your requirement. <script> require([ 'jquery' ], function ($) { $(document).ready(function () { $("body")....
Sumit's user avatar
  • 4,930

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