overriding/extending price-options.js does not workMagento 2: Override Price-options.jsMagento2 core javascript object in custom javascriptTranslation method does not workExtending / Overriding JS in Magento 2jquery scrolltop does not work in chromeOverriding Price Model Doesn't WorkMagento2 override admin js fileExtending/Overriding base JavaScript in Magento 2OverridingExtending Magento_Sales js filesHow to hide particular admin form field(UI Component) based on the value of select field?Can't validate Post Code on checkout pageUncaught Error: Mismatched anonymous define() magento 2.2.4

Vanishing of certain coefficients coming from Coxeter groups

Iterate MapThread with matrices

Find the probability that the 8th woman to appear is in 17th position.

What does "play with your toy’s toys" mean?

Suggested order for Amazon Prime Doctor Who series

How much will studying magic in an academy cost?

Should my manager be aware of private LinkedIn approaches I receive? How to politely have this happen?

Cascading Repair Costs following Blown Head Gasket on a 2004 Subaru Outback

Is my Rep in Stack-Exchange Form?

Folding basket - is there such a thing?

C-152 carb heat on before landing in hot weather?

Is it damaging to turn off a small fridge for two days every week?

Find the C-factor of a vote

How does metta sutra develop loving kindness

Unusual mail headers, evidence of an attempted attack. Have I been pwned?

What are the penalties for overstaying in USA?

First-year PhD giving a talk among well-established researchers in the field

Why did pressing the joystick button spit out keypresses?

Where do I get advice and guidance from in my PhD if my supervisor is not an expert in the field I am working on?

Wifi dongle speed is slower than advertised

How does a blind passenger not die, if driver becomes unconscious

Why do some professors with PhDs leave their professorships to teach high school?

Is this one of the engines from the 9/11 aircraft?

What is the origin of Scooby-Doo's name?



overriding/extending price-options.js does not work


Magento 2: Override Price-options.jsMagento2 core javascript object in custom javascriptTranslation method does not workExtending / Overriding JS in Magento 2jquery scrolltop does not work in chromeOverriding Price Model Doesn't WorkMagento2 override admin js fileExtending/Overriding base JavaScript in Magento 2OverridingExtending Magento_Sales js filesHow to hide particular admin form field(UI Component) based on the value of select field?Can't validate Post Code on checkout pageUncaught Error: Mismatched anonymous define() magento 2.2.4






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I need to override/extend the file price-options.js.

But it does not work, I always get the error




TypeError: undefined is not a constructor




on this line



 $.widget('myCompany.mypriceoptions', $.mage.priceOptions, {


Here are my files:



myCompanymyModuleviewfrontendrequirejs-config.js



var config = 

map:
'*':
priceOptions: 'myCompany_myModule/js/price-options',



;


myCompanymyModuleviewfrontendwebjsprice-options.js



define([
'jquery',
'underscore',
'mage/template',
'priceUtils',
'priceBox',
'priceOptions'
], function ($, _, mageTemplate, utils)
'use strict';
var globalOptions =
qtyFieldSelector: 'input.qty',
;
$.widget('myCompany.mypriceoptions', $.mage.priceOptions,
options: globalOptions,

_onOptionChanged: function onOptionChanged(event)
console.log('TEST!');
var changes,
option = $(event.target),
handler = this.options.optionHandlers[option.data('role')];
option.data('optionContainer', option.closest(this.options.controlContainer));

if (handler && handler instanceof Function)
changes = handler(option, this.options.optionConfig, this);
else
changes = defaultGetOptionValue(option, this.options.optionConfig);

$(this.options.priceHolderSelector).trigger('updatePrice', changes);
,


);

return $.myCompany.mypriceoptions;


);


EDIT:



I tried to use mixins:



myCompanymyModuleviewfrontendrequirejs-config.js



var config = 

config:
mixins:
'Magento_Catalog/js/price-options':
'myCompany_myModule/js/price-options': true




;


myCompanymyModuleviewfrontendwebjsprice-options.js



define([
'jquery',
'underscore',
'mage/template',
'priceUtils',
'priceBox',
'priceOptions'
], function ($, _, mageTemplate, utils)
'use strict';
return function (priceOptions)

return $.widget('mage.priceOptions', priceOptions,

_onOptionChanged: function onOptionChanged(event)
console.log('TEST!');
var changes,
option = $(event.target),
handler = this.options.optionHandlers[option.data('role')];
option.data('optionContainer', option.closest(this.options.controlContainer));

if (handler && handler instanceof Function)
changes = handler(option, this.options.optionConfig, this);
else
changes = defaultGetOptionValue(option, this.options.optionConfig);

$(this.options.priceHolderSelector).trigger('updatePrice', changes);


);

);


The Result is that the .js file appears in the browser, but still the magento function is used instead of the costume one.










share|improve this question






























    2















    I need to override/extend the file price-options.js.

    But it does not work, I always get the error




    TypeError: undefined is not a constructor




    on this line



     $.widget('myCompany.mypriceoptions', $.mage.priceOptions, {


    Here are my files:



    myCompanymyModuleviewfrontendrequirejs-config.js



    var config = 

    map:
    '*':
    priceOptions: 'myCompany_myModule/js/price-options',



    ;


    myCompanymyModuleviewfrontendwebjsprice-options.js



    define([
    'jquery',
    'underscore',
    'mage/template',
    'priceUtils',
    'priceBox',
    'priceOptions'
    ], function ($, _, mageTemplate, utils)
    'use strict';
    var globalOptions =
    qtyFieldSelector: 'input.qty',
    ;
    $.widget('myCompany.mypriceoptions', $.mage.priceOptions,
    options: globalOptions,

    _onOptionChanged: function onOptionChanged(event)
    console.log('TEST!');
    var changes,
    option = $(event.target),
    handler = this.options.optionHandlers[option.data('role')];
    option.data('optionContainer', option.closest(this.options.controlContainer));

    if (handler && handler instanceof Function)
    changes = handler(option, this.options.optionConfig, this);
    else
    changes = defaultGetOptionValue(option, this.options.optionConfig);

    $(this.options.priceHolderSelector).trigger('updatePrice', changes);
    ,


    );

    return $.myCompany.mypriceoptions;


    );


    EDIT:



    I tried to use mixins:



    myCompanymyModuleviewfrontendrequirejs-config.js



    var config = 

    config:
    mixins:
    'Magento_Catalog/js/price-options':
    'myCompany_myModule/js/price-options': true




    ;


    myCompanymyModuleviewfrontendwebjsprice-options.js



    define([
    'jquery',
    'underscore',
    'mage/template',
    'priceUtils',
    'priceBox',
    'priceOptions'
    ], function ($, _, mageTemplate, utils)
    'use strict';
    return function (priceOptions)

    return $.widget('mage.priceOptions', priceOptions,

    _onOptionChanged: function onOptionChanged(event)
    console.log('TEST!');
    var changes,
    option = $(event.target),
    handler = this.options.optionHandlers[option.data('role')];
    option.data('optionContainer', option.closest(this.options.controlContainer));

    if (handler && handler instanceof Function)
    changes = handler(option, this.options.optionConfig, this);
    else
    changes = defaultGetOptionValue(option, this.options.optionConfig);

    $(this.options.priceHolderSelector).trigger('updatePrice', changes);


    );

    );


    The Result is that the .js file appears in the browser, but still the magento function is used instead of the costume one.










    share|improve this question


























      2












      2








      2


      1






      I need to override/extend the file price-options.js.

      But it does not work, I always get the error




      TypeError: undefined is not a constructor




      on this line



       $.widget('myCompany.mypriceoptions', $.mage.priceOptions, {


      Here are my files:



      myCompanymyModuleviewfrontendrequirejs-config.js



      var config = 

      map:
      '*':
      priceOptions: 'myCompany_myModule/js/price-options',



      ;


      myCompanymyModuleviewfrontendwebjsprice-options.js



      define([
      'jquery',
      'underscore',
      'mage/template',
      'priceUtils',
      'priceBox',
      'priceOptions'
      ], function ($, _, mageTemplate, utils)
      'use strict';
      var globalOptions =
      qtyFieldSelector: 'input.qty',
      ;
      $.widget('myCompany.mypriceoptions', $.mage.priceOptions,
      options: globalOptions,

      _onOptionChanged: function onOptionChanged(event)
      console.log('TEST!');
      var changes,
      option = $(event.target),
      handler = this.options.optionHandlers[option.data('role')];
      option.data('optionContainer', option.closest(this.options.controlContainer));

      if (handler && handler instanceof Function)
      changes = handler(option, this.options.optionConfig, this);
      else
      changes = defaultGetOptionValue(option, this.options.optionConfig);

      $(this.options.priceHolderSelector).trigger('updatePrice', changes);
      ,


      );

      return $.myCompany.mypriceoptions;


      );


      EDIT:



      I tried to use mixins:



      myCompanymyModuleviewfrontendrequirejs-config.js



      var config = 

      config:
      mixins:
      'Magento_Catalog/js/price-options':
      'myCompany_myModule/js/price-options': true




      ;


      myCompanymyModuleviewfrontendwebjsprice-options.js



      define([
      'jquery',
      'underscore',
      'mage/template',
      'priceUtils',
      'priceBox',
      'priceOptions'
      ], function ($, _, mageTemplate, utils)
      'use strict';
      return function (priceOptions)

      return $.widget('mage.priceOptions', priceOptions,

      _onOptionChanged: function onOptionChanged(event)
      console.log('TEST!');
      var changes,
      option = $(event.target),
      handler = this.options.optionHandlers[option.data('role')];
      option.data('optionContainer', option.closest(this.options.controlContainer));

      if (handler && handler instanceof Function)
      changes = handler(option, this.options.optionConfig, this);
      else
      changes = defaultGetOptionValue(option, this.options.optionConfig);

      $(this.options.priceHolderSelector).trigger('updatePrice', changes);


      );

      );


      The Result is that the .js file appears in the browser, but still the magento function is used instead of the costume one.










      share|improve this question
















      I need to override/extend the file price-options.js.

      But it does not work, I always get the error




      TypeError: undefined is not a constructor




      on this line



       $.widget('myCompany.mypriceoptions', $.mage.priceOptions, {


      Here are my files:



      myCompanymyModuleviewfrontendrequirejs-config.js



      var config = 

      map:
      '*':
      priceOptions: 'myCompany_myModule/js/price-options',



      ;


      myCompanymyModuleviewfrontendwebjsprice-options.js



      define([
      'jquery',
      'underscore',
      'mage/template',
      'priceUtils',
      'priceBox',
      'priceOptions'
      ], function ($, _, mageTemplate, utils)
      'use strict';
      var globalOptions =
      qtyFieldSelector: 'input.qty',
      ;
      $.widget('myCompany.mypriceoptions', $.mage.priceOptions,
      options: globalOptions,

      _onOptionChanged: function onOptionChanged(event)
      console.log('TEST!');
      var changes,
      option = $(event.target),
      handler = this.options.optionHandlers[option.data('role')];
      option.data('optionContainer', option.closest(this.options.controlContainer));

      if (handler && handler instanceof Function)
      changes = handler(option, this.options.optionConfig, this);
      else
      changes = defaultGetOptionValue(option, this.options.optionConfig);

      $(this.options.priceHolderSelector).trigger('updatePrice', changes);
      ,


      );

      return $.myCompany.mypriceoptions;


      );


      EDIT:



      I tried to use mixins:



      myCompanymyModuleviewfrontendrequirejs-config.js



      var config = 

      config:
      mixins:
      'Magento_Catalog/js/price-options':
      'myCompany_myModule/js/price-options': true




      ;


      myCompanymyModuleviewfrontendwebjsprice-options.js



      define([
      'jquery',
      'underscore',
      'mage/template',
      'priceUtils',
      'priceBox',
      'priceOptions'
      ], function ($, _, mageTemplate, utils)
      'use strict';
      return function (priceOptions)

      return $.widget('mage.priceOptions', priceOptions,

      _onOptionChanged: function onOptionChanged(event)
      console.log('TEST!');
      var changes,
      option = $(event.target),
      handler = this.options.optionHandlers[option.data('role')];
      option.data('optionContainer', option.closest(this.options.controlContainer));

      if (handler && handler instanceof Function)
      changes = handler(option, this.options.optionConfig, this);
      else
      changes = defaultGetOptionValue(option, this.options.optionConfig);

      $(this.options.priceHolderSelector).trigger('updatePrice', changes);


      );

      );


      The Result is that the .js file appears in the browser, but still the magento function is used instead of the costume one.







      magento2 price javascript






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 14 at 13:18









      Aasim Goriya

      3,2371 gold badge11 silver badges43 bronze badges




      3,2371 gold badge11 silver badges43 bronze badges










      asked Jan 2 '17 at 14:52









      TrytoFlyTrytoFly

      3045 silver badges21 bronze badges




      3045 silver badges21 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          1














          The mixins functionality may help us to solve our issue:



          • http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/js_mixins.html

          • http://alanstorm.com/the-curious-case-of-magento-2-mixins/

          In your app/code/Namespace/Modulename/view/frontend/requirejs-config.js



          var config = 
          config:
          mixins:
          priceOptions:
          'Namespace_Modulename/js/price-options': true



          ;


          Read more here: https://github.com/magento/magento2/issues/7322






          share|improve this answer

























          • I tried the exact same example from github. It does not work, the js does show up in the browser, but the custom reloadPrice function doesn´t get fired.

            – TrytoFly
            Jan 3 '17 at 8:30











          • You should update the question with what you tried. I will test on my local machine.

            – Khoa TruongDinh
            Jan 3 '17 at 8:33












          • I did update the question

            – TrytoFly
            Jan 3 '17 at 13:59











          • @TrytoFly remember static files need to be cleared

            – Stevie G
            Jan 16 '17 at 9:31











          • @KhoaTruongDinh Can I call this js file in cms page only in my custom module?

            – Rohan Hapani
            Oct 4 '18 at 11:09


















          4














          Can confirm - the mixin approach worked for me.



          In app/code/Namespace/Modulename/view/frontend/requirejs-config.js



          var config = 
          config:
          mixins:
          'Magento_Catalog/js/price-options':
          'Namespace_Modulename/js/price-options-mixin': true



          ;


          and my mixin file app/code/Namespace/Modulename/view/frontend/web/js/price-options-mixin.js



          define(['jquery'], function ($) 

          return function (widget)

          $.widget('mage.priceOptions', widget,

          _onOptionChanged: function ()
          alert("This was called instead of the parent _onOptionChanged function");


          );
          return $.mage.priceOptions;

          );


          Then run this from the CLI:



          bin/magento setup:static-content:deploy





          share|improve this answer



























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f152774%2foverriding-extending-price-options-js-does-not-work%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            The mixins functionality may help us to solve our issue:



            • http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/js_mixins.html

            • http://alanstorm.com/the-curious-case-of-magento-2-mixins/

            In your app/code/Namespace/Modulename/view/frontend/requirejs-config.js



            var config = 
            config:
            mixins:
            priceOptions:
            'Namespace_Modulename/js/price-options': true



            ;


            Read more here: https://github.com/magento/magento2/issues/7322






            share|improve this answer

























            • I tried the exact same example from github. It does not work, the js does show up in the browser, but the custom reloadPrice function doesn´t get fired.

              – TrytoFly
              Jan 3 '17 at 8:30











            • You should update the question with what you tried. I will test on my local machine.

              – Khoa TruongDinh
              Jan 3 '17 at 8:33












            • I did update the question

              – TrytoFly
              Jan 3 '17 at 13:59











            • @TrytoFly remember static files need to be cleared

              – Stevie G
              Jan 16 '17 at 9:31











            • @KhoaTruongDinh Can I call this js file in cms page only in my custom module?

              – Rohan Hapani
              Oct 4 '18 at 11:09















            1














            The mixins functionality may help us to solve our issue:



            • http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/js_mixins.html

            • http://alanstorm.com/the-curious-case-of-magento-2-mixins/

            In your app/code/Namespace/Modulename/view/frontend/requirejs-config.js



            var config = 
            config:
            mixins:
            priceOptions:
            'Namespace_Modulename/js/price-options': true



            ;


            Read more here: https://github.com/magento/magento2/issues/7322






            share|improve this answer

























            • I tried the exact same example from github. It does not work, the js does show up in the browser, but the custom reloadPrice function doesn´t get fired.

              – TrytoFly
              Jan 3 '17 at 8:30











            • You should update the question with what you tried. I will test on my local machine.

              – Khoa TruongDinh
              Jan 3 '17 at 8:33












            • I did update the question

              – TrytoFly
              Jan 3 '17 at 13:59











            • @TrytoFly remember static files need to be cleared

              – Stevie G
              Jan 16 '17 at 9:31











            • @KhoaTruongDinh Can I call this js file in cms page only in my custom module?

              – Rohan Hapani
              Oct 4 '18 at 11:09













            1












            1








            1







            The mixins functionality may help us to solve our issue:



            • http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/js_mixins.html

            • http://alanstorm.com/the-curious-case-of-magento-2-mixins/

            In your app/code/Namespace/Modulename/view/frontend/requirejs-config.js



            var config = 
            config:
            mixins:
            priceOptions:
            'Namespace_Modulename/js/price-options': true



            ;


            Read more here: https://github.com/magento/magento2/issues/7322






            share|improve this answer















            The mixins functionality may help us to solve our issue:



            • http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/js_mixins.html

            • http://alanstorm.com/the-curious-case-of-magento-2-mixins/

            In your app/code/Namespace/Modulename/view/frontend/requirejs-config.js



            var config = 
            config:
            mixins:
            priceOptions:
            'Namespace_Modulename/js/price-options': true



            ;


            Read more here: https://github.com/magento/magento2/issues/7322







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 7 '17 at 7:26

























            answered Jan 2 '17 at 15:02









            Khoa TruongDinhKhoa TruongDinh

            22.8k6 gold badges45 silver badges91 bronze badges




            22.8k6 gold badges45 silver badges91 bronze badges












            • I tried the exact same example from github. It does not work, the js does show up in the browser, but the custom reloadPrice function doesn´t get fired.

              – TrytoFly
              Jan 3 '17 at 8:30











            • You should update the question with what you tried. I will test on my local machine.

              – Khoa TruongDinh
              Jan 3 '17 at 8:33












            • I did update the question

              – TrytoFly
              Jan 3 '17 at 13:59











            • @TrytoFly remember static files need to be cleared

              – Stevie G
              Jan 16 '17 at 9:31











            • @KhoaTruongDinh Can I call this js file in cms page only in my custom module?

              – Rohan Hapani
              Oct 4 '18 at 11:09

















            • I tried the exact same example from github. It does not work, the js does show up in the browser, but the custom reloadPrice function doesn´t get fired.

              – TrytoFly
              Jan 3 '17 at 8:30











            • You should update the question with what you tried. I will test on my local machine.

              – Khoa TruongDinh
              Jan 3 '17 at 8:33












            • I did update the question

              – TrytoFly
              Jan 3 '17 at 13:59











            • @TrytoFly remember static files need to be cleared

              – Stevie G
              Jan 16 '17 at 9:31











            • @KhoaTruongDinh Can I call this js file in cms page only in my custom module?

              – Rohan Hapani
              Oct 4 '18 at 11:09
















            I tried the exact same example from github. It does not work, the js does show up in the browser, but the custom reloadPrice function doesn´t get fired.

            – TrytoFly
            Jan 3 '17 at 8:30





            I tried the exact same example from github. It does not work, the js does show up in the browser, but the custom reloadPrice function doesn´t get fired.

            – TrytoFly
            Jan 3 '17 at 8:30













            You should update the question with what you tried. I will test on my local machine.

            – Khoa TruongDinh
            Jan 3 '17 at 8:33






            You should update the question with what you tried. I will test on my local machine.

            – Khoa TruongDinh
            Jan 3 '17 at 8:33














            I did update the question

            – TrytoFly
            Jan 3 '17 at 13:59





            I did update the question

            – TrytoFly
            Jan 3 '17 at 13:59













            @TrytoFly remember static files need to be cleared

            – Stevie G
            Jan 16 '17 at 9:31





            @TrytoFly remember static files need to be cleared

            – Stevie G
            Jan 16 '17 at 9:31













            @KhoaTruongDinh Can I call this js file in cms page only in my custom module?

            – Rohan Hapani
            Oct 4 '18 at 11:09





            @KhoaTruongDinh Can I call this js file in cms page only in my custom module?

            – Rohan Hapani
            Oct 4 '18 at 11:09













            4














            Can confirm - the mixin approach worked for me.



            In app/code/Namespace/Modulename/view/frontend/requirejs-config.js



            var config = 
            config:
            mixins:
            'Magento_Catalog/js/price-options':
            'Namespace_Modulename/js/price-options-mixin': true



            ;


            and my mixin file app/code/Namespace/Modulename/view/frontend/web/js/price-options-mixin.js



            define(['jquery'], function ($) 

            return function (widget)

            $.widget('mage.priceOptions', widget,

            _onOptionChanged: function ()
            alert("This was called instead of the parent _onOptionChanged function");


            );
            return $.mage.priceOptions;

            );


            Then run this from the CLI:



            bin/magento setup:static-content:deploy





            share|improve this answer





























              4














              Can confirm - the mixin approach worked for me.



              In app/code/Namespace/Modulename/view/frontend/requirejs-config.js



              var config = 
              config:
              mixins:
              'Magento_Catalog/js/price-options':
              'Namespace_Modulename/js/price-options-mixin': true



              ;


              and my mixin file app/code/Namespace/Modulename/view/frontend/web/js/price-options-mixin.js



              define(['jquery'], function ($) 

              return function (widget)

              $.widget('mage.priceOptions', widget,

              _onOptionChanged: function ()
              alert("This was called instead of the parent _onOptionChanged function");


              );
              return $.mage.priceOptions;

              );


              Then run this from the CLI:



              bin/magento setup:static-content:deploy





              share|improve this answer



























                4












                4








                4







                Can confirm - the mixin approach worked for me.



                In app/code/Namespace/Modulename/view/frontend/requirejs-config.js



                var config = 
                config:
                mixins:
                'Magento_Catalog/js/price-options':
                'Namespace_Modulename/js/price-options-mixin': true



                ;


                and my mixin file app/code/Namespace/Modulename/view/frontend/web/js/price-options-mixin.js



                define(['jquery'], function ($) 

                return function (widget)

                $.widget('mage.priceOptions', widget,

                _onOptionChanged: function ()
                alert("This was called instead of the parent _onOptionChanged function");


                );
                return $.mage.priceOptions;

                );


                Then run this from the CLI:



                bin/magento setup:static-content:deploy





                share|improve this answer















                Can confirm - the mixin approach worked for me.



                In app/code/Namespace/Modulename/view/frontend/requirejs-config.js



                var config = 
                config:
                mixins:
                'Magento_Catalog/js/price-options':
                'Namespace_Modulename/js/price-options-mixin': true



                ;


                and my mixin file app/code/Namespace/Modulename/view/frontend/web/js/price-options-mixin.js



                define(['jquery'], function ($) 

                return function (widget)

                $.widget('mage.priceOptions', widget,

                _onOptionChanged: function ()
                alert("This was called instead of the parent _onOptionChanged function");


                );
                return $.mage.priceOptions;

                );


                Then run this from the CLI:



                bin/magento setup:static-content:deploy






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jun 14 at 12:26









                Bhupendra Jadeja

                2,18415 silver badges37 bronze badges




                2,18415 silver badges37 bronze badges










                answered May 4 '17 at 0:30









                Jimmy BeatsJimmy Beats

                412 bronze badges




                412 bronze badges



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f152774%2foverriding-extending-price-options-js-does-not-work%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form