Total : 0.00 €

Woo Price Calculator User Manual

17 - jQuery Triggers - WPC

It's possible to create custom jQuery functions to extend WooPrice Calculator features. If you need to add custom Javascript to your website you could install this plugin.

  • awspcBeforeCalculatePrice: This function is called before the price calculation.
  • awspcAfterCalculatePrice: This function is called after the price calculation.
  • awspcAjaxCalculatePrice [WPC >= 2.3.0]: This function is called before the Ajax request is sent
  • awspcAjaxCalculatePriceSuccess [WPC >= 2.3.0]: This function is called after the Ajax request is sent (Request success)
  • awspcBeforeProductCalculatePrice [WPC >= 2.3.0]: The same as "awspcBeforeCalculatePrice", but executed only on Product Page.
  • awspcAfterProductCalculatePrice [WPC >= 2.3.0]: The same as "awspcAfterCalculatePrice" but executed only on Product Page.

Working examples:

Trigger "awspcBeforeCalculatePrice"

jQuery(document).bind("awspcBeforeCalculatePrice", function(ev){
	alert("Message before price calculation");
});

Trigger "awspcAfterCalculatePrice"

jQuery(document).bind("awspcAfterCalculatePrice", function(ev){
	alert("Message after price calculation");
});

Trigger "awspcAjaxCalculatePrice"

jQuery(document).bind("awspcAjaxCalculatePrice", function(ev){
	alert("Message before ajax request is sent");
});

Trigger "awspcAjaxCalculatePriceSuccess"

Using this function is possible to retrive request parameters:

  • result.price: The calculated price
  • result.erros: List of fields errors
  • result.errorsCount: Number of fields with errors
  • result.outputFields: Output fields
  • result.conditionalLogic: Calculated Conditional Logic

 

jQuery(document).bind("awspcAjaxCalculatePriceSuccess", function(ev, args){
    alert("Message after ajax request is sent (success), fields with error: " + args.result.errorsCount);
});

Cart

Total : 0.00 €