1

I am trying to add custom text after price display everywhere(globally) in website.

  1. category view
  2. product view
  3. Mini cart
  4. cart page
  5. checkout page etc..

can anyone help to me...

0

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.

  • Yes, but it will only change in product view page .I need everywhere in cart checkout etc... – Tirth Patel Jul 10 at 8:24
0

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.

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.