1

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?

1 Answer 1

4

The action hook publish_post doesn't work for custom post types. You need to use the following format: publish_{$custom_post_type}

As you are using Woocommerce this post type is product so you want to use: publish_product.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.