i want make webhook when make product one make attribute or one update attribute for example :

function add_this_to_new_products( $new_status, $old_status, $post ) {
    $defaults = array ( 'shopid' => array (
                                  'name' => 'shopid',
                                  'value' => 'mahdi',
                                  'position' => 1,
                                  'is_visible' => 1,
                                  'is_variation' => 1,
                                  'is_taxonomy' => 1,
                               ),

    );

update_post_meta( $post->ID , '_product_attributes', $defaults );

}

add_action( 'transition_post_status', 'add_this_to_new_products', 10, 3 );

Or

function add_this_to_new_products( $new_status, $old_status, $post ) {
    $defaults = get_bloginfo();
update_post_meta( $post->ID , '_product_attributes', $defaults );


}

add_action( 'transition_post_status', 'add_this_to_new_products', 10, 3 );

But none do not work. please guide me. thank you

Read more here: How To New Create attribute in woocommerce With webhook automatically


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: