I am trying to add custom text after price display everywhere(globally) in website.
- category view
- product view
- Mini cart
- cart page
- checkout page etc..
can anyone help to me...
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI am trying to add custom text after price display everywhere(globally) in website.
can anyone help to me...
Please try to override Magento/Catalog/view/base/templates/product/price/amount/default.phtml
from core vendor to your theme path and added the text in the above or after rendering price.
This for list page :
Vendor/Module/view/frontend/requirejs-config.js
var config = {
config: {
mixins: {
'Magento_Catalog/js/price-box': {
'Vendor_Module/js/price-box-mixin': true
}
}
}
};
var/www/html/olystudio/vendor/magento/module-catalog/view/base/web/js/price-box.js
define(['jquery'], function ($) {
return function (widget) {
var globalOptions = {
productId: null,
priceConfig: null,
prices: {},
priceTemplate: '<span class="price"><%- data.formatted %>/ custom-text</span>'
};
$.widget('mage.priceBox', widget, {
options: globalOptions
});
return $.mage.priceBox;
}
});
Checkout Cart and Summary page :
https://webkul.com/blog/display-custom-price-fee-checkout-cart-summary-total-magento2/
I hope its work for you.