Skip to content

Instantly share code, notes, and snippets.

@wooxperto
Created August 10, 2023 05:44
Show Gist options
  • Save wooxperto/9166d0c2a2b3acef192684f66e1ceb50 to your computer and use it in GitHub Desktop.
Save wooxperto/9166d0c2a2b3acef192684f66e1ceb50 to your computer and use it in GitHub Desktop.
Add a continue shopping button at single product page on WooCommerce.
<?php
/**
* @snippet Add a continue shopping button at single proudct page | WooCommerce
* @author WooXperto
* @date 10.08.2023
*/
add_action( 'woocommerce_single_product_summary', 'WooXperto_continue_shopping_button', 31 );
function WooXperto_continue_shopping_button() {
if ( wp_get_referer() ) echo '<a class="button continue" href="' . wp_get_referer() . '">Continue Shopping</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment