0

There's an extension in my website that loads price-box.js in all website pages.

requirejs-config.js

var config = {
  "map": {
    "*": {
      priceBox: 'FME_Pricecalculator/js/price-box'
    }
  }
};

I'd like to remove that file from all category list pages. I tried doing that by layout xml files, but didn't work.

catalog_category_view.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <remove src="FME_Pricecalculator::js/price-box.js" />
    </head>
</page>

What is the proper way to remove that price-box.js file?

  • It depends on how it was added, if you search for the file can you find that out? – Ben Crook Jan 14 at 16:40
  • @BenCrook it was added via require-js, as I mentioned above – zekia 2 days ago
  • There are several ways to add a JS file with Require JS. If it was added as a dependency in another Require JS file then you'll need to overwrite that file and leave out that dependency. – Ben Crook 2 days ago
  • I don't understand. The only file that mentions price-box.js file, is requirejs-config.js, which is posted on description. I can't find any other file in extension that inserts price-box.js in pages. – zekia 2 days ago
  • The require JS config you shared isn't loading the JS file it just maps the alias so when you call priceBox it will load 'FME_Pricecalculator/js/price-box'. See devdocs.magento.com/guides/v2.3/javascript-dev-guide/javascript/… for more info on that. If you search your whole project for 'priceBox' can you find another JS file? – Ben Crook 2 days ago

Your Answer

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

Browse other questions tagged or ask your own question.