0
votes

I have to echo some parameters to woocommerce quick edit row. ( It makes easier for editor to decide what price to put without opening woocommerce product. )

wc_get_product_terms is good function to get excact parameter, but I need there post ID. With add_action( 'woocommerce_product_quick_edit_end' I can add this to quick edit bottom.

Have anyone idea, how to achieve post id with php? Half of the code is here:

add_action( 'woocommerce_product_quick_edit_end', function () {

    //how to get the post id in each quick edit row with php?

    $height = array_shift( wc_get_product_terms( $post->ID, 'pa_height', array( 'fields' => 'names' ) ) );
    $width  = array_shift( wc_get_product_terms( $post->ID, 'pa_width', array( 'fields' => 'names' ) ) );
    $radius    = array_shift( wc_get_product_terms( $post->ID, 'pa_radius', array( 'fields' => 'names' ) ) );


} );
1

1 Answers

-1
votes

Did you try get_the_id() instead of $post->ID? Could be worth a try. Reference: https://developer.wordpress.org/reference/functions/get_the_id/