I want to rewrite method openVariableChooser in variables js called somewhere in Editor magento. But i don't know how to do that without affect to other module
File variables location in Magento_Variable/variables.js
What i have done is define my custom js over original.

"paths": {
    "Magento_Variable/variables": "My_Extension/js/custom_variables"
  • You can override using theme inside Magento_Variable/web/js folder Jan 12, 2017 at 12:37
  • How to do that in module
    – mrtuvn
    Jan 12, 2017 at 12:41

1 Answer 1


You can do it using module like this,

Create file, requirejs-config.js


var config = {
    map: {
        '*': {
            "Magento_Variable/variables": 'Vendor_Modulename/variables',

Create app/code/Vendor/Modulename/view/adminhtml/web/variables.js file

run command, php bin/magento setup:static-content:deploy

clear cache and browser cache.

  • have you worked this method? Jan 12, 2017 at 13:22
  • Worked in my module but still affect to cms module. Cms not working properly. Try to insert variable in cms i had to click twice to make it work
    – mrtuvn
    Jan 12, 2017 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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