Support » Plugin: WooCommerce » Email order number

  • Hi,

    I’ve built a script where it shows a button on the site that at the moment its pressed, it sends the admin an email.

    I’m trying to send an email that shows the purchased items in woocommerce.

    Is this possible?

    So if user didn’t bought any products before it doesnt show anything.

    But if the user bought something, it shows all the product id’s that he/she has bought.

    Hope someone can help me out!

    Thanks!

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Thread Starter Fernon

    (@fernon)

    at the moment I have this code:

    if(isset($_POST[‘button_pressed’]))
    {
    $to = ‘fernonsih@gmail.com’;
    $subject = ‘the subject’;
    $message = ‘hello’;
    $headers = ‘From: webmaster@example.com’ . “\r\n” .
    ‘Reply-To: webmaster@example.com’ . “\r\n” .
    ‘X-Mailer: PHP/’ . phpversion();

    mail($to, $subject, $message, $headers);

    echo ‘Email Sent.’;
    }

    the problem is that if the user bought 4 products, it sends me 4 emails. I want it to send 1 email.

    Is there a function that has a if statement?

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Email order number’ is closed to new replies.