28
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="...
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 ...
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 ...
17
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 ...
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();
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!
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-...
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”
...
10
votes
Get Product Attribute value
$_product = $block->getProduct();
$myattribute = $_product->getResource()->getAttribute('Your_Attribute_Code')->getFrontend()->getValue($_product);
echo $myattribute;
if want to show ...
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 ...
9
votes
Magento 2: Hide other shipping methods when free shipping is available
Use the extension ShippingTweaks.
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/...
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/...
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\...
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 ...
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, ...
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 ...
7
votes
Magento2: How to get shipping method in order using observer `sales_order_save_after`?
$order->getShippingDescription(); // returns Shipping Method Title
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
/...
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->...
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
...
7
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 ...
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 ...
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-...
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 ...
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 ...
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\...
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....
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: {
...
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")....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
shipping-methods × 1033magento2 × 429
shipping × 260
magento-1.9 × 192
checkout × 157
magento-2.1 × 68
onepage-checkout × 56
shipping-address × 53
free-shipping × 51
table-rates × 51
cart × 43
magento2.3 × 39
magento-1.7 × 35
payment-methods × 35
magento-1.8 × 34
fedex × 34
ups × 32
module × 31
php × 28
orders × 25
magento2.2 × 21
quote × 19
checkout-page × 19
shopping-cart-price-rules × 17
admin × 15