get woocommerce product variation id

i am currently developing an extension for woocommerce. I am hooking into the admin variations tab like this:

add_action( 'woocommerce_product_after_variable_attributes' ,'wwp_add_variable_wholesale_price' );

function wwp_add_variable_wholesale_price(){

    global $post, $woocommerce;
    $post_id = $post->ID;
    echo $post_id;

}

Them above is currently displayin the parent product id, and not the variation id. Does anyone know how to get the actual variation id?

Related posts

Leave a Reply

1 comment

  1. Add the action like this:

    add_action( 'woocommerce_product_after_variable_attributes', 'wwp_add_variable_wholesale_price', 10, 3);
    
    function wwp_add_variable_wholesale_price($loop, $variation_data, $variation){
    
    global $post, $woocommerce;
    $post_id = $variation->ID;
    echo $post_id;
    
    }