Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Last active March 20, 2021 02:37
Show Gist options
  • Save rynaldos-zz/a1b901e1b98eef3646fa07c6465db6de to your computer and use it in GitHub Desktop.
Save rynaldos-zz/a1b901e1b98eef3646fa07c6465db6de to your computer and use it in GitHub Desktop.
[WooCommerce 3.0] Add "go back" button on single product page
add_action( 'woocommerce_after_add_to_cart_button', 'my_function_sample', 10 );
function my_function_sample() {
global $product;
echo ' <button type="button" onclick="history.back();"> Go back </button> ';
}
// Did this help? Donate me some BTC: 1BEsm8VMkYhSFJ92cvUYwxCtsfsB2rBfiG
@vhfferreira
Copy link

If i want the onclick event to send me back to shop how do i code it?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment