Send Admin an Email When Product is Updated

If you have your site set to require review of all products when they are published, it also means that the Vendors can’t update their listings without a review. That takes down their listing until the admin reviews and publishes their listing again. The problem is, the admin does not receive any kind of notification by default when the vendor updates their item, like it does when they first submit it for review. This snippet sends a super basic text email to whatever email address you specify. For me, it was my admin email address with a quick note to tell me to go to my To Do List page.

This was hugely important for me, since a simple update of something like a price would take down the vendor’s listing. Meanwhile, they had posted direct links to their products and people were attempting to buy them.

Note: I have since moved past this and commissioned a whole plugin that gives my vendors the ability the update their listings after they are published without taking their item down for review. Further, it gives my users the ability to choose to either publish directly or submit their product to the admin for review. Find it in the Plugins section of the site.

As always, this is either added to your Child Theme’s functions.php file, or consider using the My Custom Functions Pro plugin to manage and organize all your snippets.

add_action( 'wcmp_process_product_object', 'send_mail_after_update_product' , 10 , 2 );

function send_mail_after_update_product( $product , $post ){
   wp_mail( 'hello@example.com' , 'Product Updated' , 'Go to your To Do list' );
}

Is this no longer relevant or not working? Please let us know in the comments!

Comments on this post

Your email address will not be published. Required fields are marked *