In vendor/magento/module-catalog/view/base/web/js/price-options.js there is a method _onOptionChanged: function onOptionChanged(event).

I would like to call this method in my template when page load.


How can i achieve this? is it possible to call this method in my template file ? if possible please help me and suggest me how can do it?

1 Answer 1


You can't do it in template, and you can't access directly to a private method. You can do it in a requireJS module through the mixins configuration.

See the docs.

In your case you could do something like his:

var config = {
        'mixins': {
            'priceOptions': {
                'Vendor_Module/script' : true

And in your script.js

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

    return function (widget) {

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

           yourMethod: function () {

       return $.mage.priceOptions;

Your Answer

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

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