• Resolved aryup

    (@aryup)


    Hi,

    When a customer “send message” from a contact form, the seller receive a mail with only the field “Message” fill by the customer. Can we also add in this notification the name of the product and the name of the customer inside the notification ?

    Something like this :

    Customer name : Nick
    Product name : Amazon Echo v2
    Customer message : I would like to purchase your item, is he still available

    Thanks by advance.

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    you can customize the message sent using the Contact Form with the adverts_contact_form_email filter, you can see how to use it here https://github.com/simpliko/wpadverts-snippets/blob/master/contact-form-email/contact-form-email.php

    In your case you would want to add the following code to the theme functions.php file

    
    add_filter( "adverts_contact_form_email", "contact_form_email", 10, 3 );
    function contact_form_email( $mail, $post_id, $form ) {
        // get the post
        $post = get_post( $post_id );
        $message = $mail['message'];
        $mail["message"]  = sprintf( "Customer name: %s", get_post_meta( $post_id, 'adverts_person', true ) . '\r\n';
        $mail["message"] .= sprintf( "Product name: %s", $post->post_title . '\r\n';
        $mail["message"] .= sprintf( "Customer message: %s", $message . '\r\n';
        return $mail;
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Add information to the notification receive by the customer’ is closed to new replies.