I would like to display Materialize framework Toast, when the product has been added to cart. The hook for it is woocommerce_ajax_add_to_cart
, or at least I think it is from all the google material I have managed to dig up.
My problem is I can not get it to work. What would be the best approach for that, how would I be able to hook into it.
I have this in my functions.php
:
add_action('woocommerce_ajax_add_to_cart', 'run_toast_after_add_to_cart');
function run_toast_after_add_to_cart() {
echo '<a class="btn" onclick="Materialize.toast('I am a toast', 4000)">Toast!</a>';
}
But I get:
Parse error: syntax error, unexpected 'I' (T_STRING), expecting ',' or ';'