WooCommerce – Hook after Loading Variation in Admin Edit page?

In woocommerce/includes/class-wc-ajax.php there is a method on the WC_AJAX class responsible for loading variations called load_variations, it contains only one hook, which is a filter, named woocommerce_ajax_admin_get_variations_args which fires early in the method.

However if you are looking for something client side, then woocommerce/assets/js/admin/meta-boxes-product-variation.js triggers an event on the success callback of the load_variations function named woocommerce_variations_loaded.

Therefore if you are looking to fire subsequent actions using JS, then:

$(document).on('woocommerce_variations_loaded', function(event) {
    //your code here...
});

Or you can try binding to the element in which the trigger is executed upon:

$('#woocommerce-product-data').on('woocommerce_variations_loaded', function(event) {
    //your code here...
});

Leave a Comment