search
Log In
Welcome to Blogiestools Ask, a blogging community where beginner and professional bloggers come to seek answers from other bloggers’ experiences.

You can ask questions related to starting a blog, monetizing a blog, marketing a blog, managing a blog, fixing a problem, the best web tech tools to use, etc.

Register or log in to ask or answer questions.

Ask a Question

0 votes
I have a digital marketplace running on WooCommerce. How do I notify vendors when an admin rejects their submitted product?
in WordPress Problems

1 Answer

0 votes

I you are running a digital marketplace website on WooCommerce where vendors can submit their products from the front-end account, then you can notify them via email when their product has been rejected using the code below.

NOTE: Modify the highlighted text  in orange with your custom text. The first line of texts is for the subject  of the email.

/* Notify Seller via email when Product is Rejected */

add_action( 'pending_to_trash', 'WooCommerce_notify_vendor_on_blogies' );
function WooCommerce_notify_vendor_on_blogies( $post_id ) {
    global $post;
    if ( $post->post_author != get_current_user_id() ) {
        $author = new WP_User( $post->post_author );
        $email_data = array(
            'to'      => $author->user_email,
            'subject' => sprintf( __( 'Your product has been rejected', 'email_author_on_publish' ), get_bloginfo('name') ),
            'message' => sprintf( __( 'Your submitted product has been rejected. To learn more on why your product was rejected, visit https://blogiestools.com/submission/. Thanks.', 'email_author_on_publish' ), $post->post_title, get_bloginfo( 'name' ), get_permalink( $post->ID ) ),
        );
        wp_mail( $email_data['to'], $email_data['subject'], $email_data['message'] );
    }
}

15.1k points

Related questions

0 votes
1 answer
I want to modify the WooCommerce checkout loading spinner gif and use my custom icon and text
asked Nov 8, 2021 in WordPress Problems anonymous
1 vote
1 answer
I want to allow guest customers to checkout in WooCommerce with specific email domains. I do not want accounts to be registered during checkout with disposable emails.
asked Nov 8, 2021 in WordPress Problems anonymous
0 votes
1 answer
I need a code to change WooCommerce add cart button text without installing a plugin
asked Nov 8, 2021 in WordPress Problems anonymous
1 vote
1 answer
How I do remove WooCommerce Checkout fields that is billing details and order comments without a plugin.
asked Nov 8, 2021 in WordPress Problems anonymous
0 votes
1 answer
I need to display a featured image on my WooCommerce product category pages
asked Nov 5, 2021 in WordPress Problems anonymous