I want to add an action whenever the admin publishes a product, but the WP hook publish_post does not trigger then – even though a wc product is just another type of post.
I haven’t found a woocommerce hook that triggers when a product is published.
Any thoughts?
I recommand you to use the
transition_post_status
. See example below :This hook is really handy. It allows you to target a specific action: every time post data is saved. But with code I add you can avoid trigger your code if it’s a draft save or an updtate.
If You add a new product in woocommerce then send
product_id
I think the best way is to use :
http://woocommerce.wp-a2z.org/oik_api/wp_transition_post_status/