0

I am working on the configurable product view page.

I want to add an event to check if all options are checked before an AJAX call.

I tried a solution like this to override the widget Magento_Swatches/js/SwatchRenderer, but failed. When I clicked or I chose an option, it didn't execute my custom function.

Do you have some advise for my problem and how should i do it?

Did I forgot something?

0

I found my problem, this is my soluytion.

define([
    'jquery',
    'underscore',
    'jquery/ui',
    'jquery/jquery.parsequery',
    'swatchRenderer'
], function( $, _ ){
    'use strict';

    $.widget( "mage.SwatchRenderer", $.mage.SwatchRenderer, {
        _init: function () {
            console.log( "custom init" );
            return this._super( );
        },
        _OnClick: function ($this, $widget) {
            console.log( "Custome click" );
            return this._super( $this, $widget );
        }
    });

    return $.mage.SwatchRenderer;

});
| improve this answer | |

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.