From 4bde10e639ff92b049884add6a96c6911cb8f492 Mon Sep 17 00:00:00 2001 From: Saimon Sajjad Date: Mon, 25 Feb 2019 10:38:38 +0600 Subject: [PATCH] fix: send email to admin on adding a new product via REST API (#562) --- includes/api/class-api-rest-controller.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/api/class-api-rest-controller.php b/includes/api/class-api-rest-controller.php index c941061a63..6355ff7826 100644 --- a/includes/api/class-api-rest-controller.php +++ b/includes/api/class-api-rest-controller.php @@ -94,6 +94,10 @@ public function create_item( $request ) { //Update post author wp_update_post( array( 'ID' => $object->get_id(), 'post_author' => dokan_get_current_user_id() ) ); + + // send email to admin on adding a new product + do_action( 'dokan_new_product_added', $object->get_id(), $request ); + return $this->prepare_data_for_response( $this->get_object( $object->get_id() ), $request ); } catch ( WC_Data_Exception $e ) { return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );