How to create new attribute in woocommerce with webhook automatically
-
i want to make a webhook when adding a product or an attribute or updating an 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 of these works. please guide me. Thank you
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to create new attribute in woocommerce with webhook automatically’ is closed to new replies.