Skip to content
Gunjan Patel edited this page Jun 28, 2016 · 1 revision

Now, it is easy to set JavaScript trigger function on add to cart button.

Add to cart button JavaScript Trigger

Create Trigger function in your plugin js file or you can use your existing js function

var MyAddToCartTrigger = function(){
    console.log("Hello, from My trigger function");
};

Register Trigger function from your plugin js file

// Set Trigger for add to cart button
redShopJsTrigger.push(MyAddToCartTrigger);

Create another trigger in another plugin js file

var SecondAddToCartTrigger = function(){
    console.log("Hello, from Second trigger function");
};

Register Second Trigger function from your plugin js file

// Set Trigger for add to cart button
redShopJsTrigger.push(SecondAddToCartTrigger);

Now, both function will be trigger on click of redSHOP add to cart button

On Attribute dropdown change JavaScript Trigger

Create Trigger function in your plugin js file or you can use your existing js function

var myAwesomeScript = function(){
    console.log("Hello, from My trigger function");
};

Register Trigger function from your plugin js file

// Set Trigger for add to cart button
redSHOP.onChangePropertyDropdown.push(myAwesomeScript);

Clone this wiki locally