i want to change the Shipping Method Name programmatically in some cases. enter image description here

(This store is in german)

So I want to change "Versand oder Abholung" to another different text depending on the case.

How can I manipulate this text?

I have found the .html file which contains this div. (Maybe this will help?) app\design\frontend\MyStore\MyStoreTheme\Magento_Checkout\web\shipping.html

<form class="form methods-shipping" id="co-shipping-method-form" data-bind="submit: setShippingInformation" novalidate="novalidate">
            <div id="checkout-shipping-method-load">
                <table class="table-checkout-shipping-method">
                        <tr class="row">
                            <th class="col col-method" data-bind="i18n: 'Select Method'"></th>
                            <th class="col col-price" data-bind="i18n: 'Price'"></th>
                            <th class="col col-method" data-bind="i18n: 'Method Title'"></th>
                            <th class="col col-carrier" data-bind="i18n: 'Carrier Title'"></th>

... ... ...

<td class="col col-method" data-bind="text: method.method_title, attr: {'id': 'label_method_' + method.method_code + '_' + method.carrier_code}"></td>

Any ideas? ;)


Ok I have found a solution.

use Magento\Quote\Model\Quote\Address\RateRequest;

    class Tablerate extends \Magento\OfflineShipping\Model\Carrier\Tablerate
        public function collectRates(RateRequest $request)
            $result = $this->_rateResultFactory->create()
            $method = $this->_resultMethodFactory->create();
            return $result;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.