How to change message? see below image
-
1Let me know if you have any issue – Prince Patel Jul 27 '17 at 9:06
You need to override shipping.html in your theme from vendor/magento/module-checkout/view/frontend/web/template/shipping.html
.
With Custom Theme:
Copy vendor shipping.html file to your custom theme at app/design/frontend/Vendor/theme/Magento_Checkout/web/template/shipping.html
Note: Make sure you first delete static shipping.html from pub/static
from pub/static/frontend/Vendor/theme/en_US/Magento_Checkout/template/shipping.html
Now change text at last no-quotes-block
div to your custom message
<div class="no-quotes-block"><!-- ko i18n: 'Default Shipping Message Changed......'--><!-- /ko --></div>
Now flush cache and try.
OR With Custom Module:
Copy vendor shipping.html file to your custom module at app/code/Vendor/Module/view/frontend/web/template/shipping.html
Now add requirejs-config.js at app/code/Vendor/Theme/view/frontend/requirejs-config.js
var config = {
map: {
'*': {
'Magento_Checkout/template/shipping.html':
'Vendor_Module/template/shipping.html'
}
}
};
Note: Make sure you first delete static shipping.html from pub/static
from pub/static/frontend/vendor/module/en_US/Magento_Checkout/template/shipping.html
Now flush cache and try.
OUTPUT:
-
We need not
requirejs
at the time of overriding template file with a custom theme. we only needrequirejs
at the time of overriding template file with a custom module. – Prince Patel Jul 27 '17 at 10:58 -
Hello prince above all steps are follow but its not working .plz help me.? – Devidas Jul 28 '17 at 13:26
-
Please make sure you delete file from pub /static folder or run
php bin/magento setup:static-content:deploy
after changes. – Prince Patel Jul 28 '17 at 16:02
As far as I can see this sentence appears in two places:
vendor/magento/module-checkout/view/frontend/web/template/shipping.html
and
vendor/magento/module-checkout/view/frontend/web/template/cart/shipping-rates.html
Said that and depending on what you want to achieve you could:
Overwrite those files in your theme
By placing your own content in
app/design/frontend/{vendor}/{theme}/Magento_Checkout/web/template/cart/shipping.html
and
app/design/frontend/{vendor}/{theme}/Magento_Checkout/web/template/cart/shipping-rates.html
Overwrite those files in your extension
Create a requirejs-config.js in your extension
app/code/Namespace/Mudule/view/frontend/requirejs-config.js
and place the following content
var config = {
map: {
'*': {
'Magento_Checkout/template/cart/shipping-rates.html':
'Namespace_Module/template/cart/shipping-rates.html'
}
}
};
-
1why do you also need to create the requirejs? Is not enough override html file in theme? – LucScu Jul 27 '17 at 9:46
-
They are two different ways to do the same thing. If you creating a theme, it makes more sense to modify the theme, if you are working on a custom module, it makes more sense to do it in your module so you can pack all your changes at the end. – diazwatson Jul 27 '17 at 10:02
-
1
-
I think there is even a way to change an html file using a layout xml. As I said, multiple ways to do the same thing, all depends on what suit you purpose better. :) – diazwatson Jul 27 '17 at 10:18
-
1@LucaS and @diazwatson we need
requireJs
only when we override static html file with a custom module. It does not require at the time of overriding static files with a custom theme. So for this task, it's not required to add requirejs :) – Prince Patel Jul 27 '17 at 10:55