basic wordpress plugin throws SyntaxError: Unexpected token

Here is the basic wordpress plugin that hooks to woocommerce action tag. I try to understand the concept. But I get the error when I try to checkout on the page.

add_action( 'wc_order_statuses', 'wpwoopush_test');
function wpwoopush_test() {
    wp_mail($email,$title,$text);
    return true;
}

Error:

Read More
<div class="woocommerce-error">SyntaxError: Unexpected token &lt;</div>

UPDATE:
wp_mail() function is just an example $email,$title,$text defined correctly. It throws the same error event wp_mail() is commented out.

Related posts

1 comment

  1. You aren’t even passing any variables to the function, so using wp_mail is useless because it has no information from the function to use.

    You need to define the following:
    wp_mail($email,$titile,$text);

    More specifically:
    $email,$titile,$text

    inside your functions parameters: function wpwoopush_test($email,$titile,$text)

    and as @Ben suggested, spell check on your variable names ($titile) so you aren’t using an undefined variable in the function if you go to edit it later.

    Hope this helps!

Comments are closed.