Javascript Event Triggers for Before and After Loading of the Wholesale Order Form

Javascript Event Triggers for Before and After Loading of the Wholesale Order Form

In our WooCommerce Wholesale Order Form version 1.13, we introduced new Javascript event triggers for before and after loading of the Wholesale Order Form.
These new event triggers are useful for shops that have custom Javascript functionalities. With this new feature, they can easily customize their Wholesale Order Form.
List of Triggers:

trigger: before_load_product_listing
element: #wwof_product_listing_container
parameters: [ paged , search , catFilter , $shortcodeAtts , first_load ]

trigger: after_load_product_listing
element: #wwof_product_listing_container
parameters: [ paged , search , catFilter , $shortcodeAtts , first_load ]

trigger: found_variation
element: #wwof_product_listing_table tbody tr
parameter: [ new_variation ] (this contains data of new selected variation)

trigger: added_to_cart
element: body
parameters: [ fragments, cart_hash, $button ] (this uses the same parameters as the one in WC. see https://github.com/woocommerce/woocommerce/blob/master/assets/js/frontend/add-to-cart.js#L63)

Example Usage
You can use the javascript event triggers like so:

jQuery( '#wwof_product_listing_container' ).on(
'before_load_product_listing',
function(e, paged, search , catFilter , atts , first ) {
console.log( paged );
console.log( search );
console.log( catFilter );
console.log( atts );
console.log( first );
}
);
Replace the console logs with whatever you want your code to do when this event happens.
Having an issue?
If you are still running into problems with the new event triggers, feel free to reach out to our friendly support team for advice.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註