Home » WooCommerce: “Continue Shopping” Button @ Single Product Page

WooCommerce: “Continue Shopping” Button @ Single Product Page

by Tutor Aspire

A freelance client hired me a while ago to display a “Continue Shopping” button on the Single Product Page, next to the Add to Cart. A simple way to send their users back to where they were coming from without clicking the “previous” button on the browser 🙂

Here’s how it’s done, featuring an awesome WordPress function called “wp_get_referer()”!

Continue Shopping button @ WooCommerce Single Product Page

PHP Snippet: “Continue Shopping” Button @ Single Product Page – WooCommerce

 

/**
 * @snippet       Continue Shopping button @ Single Product Page
 * @how-to        Get tutoraspire.com FREE
 * @sourcecode    https://tutoraspire.com/?p=72772
 * @author        Tutor Aspire
 * @testedwith    WooCommerce 3.1.1
 */

add_action( 'woocommerce_single_product_summary', 'tutoraspire_continue_shopping_button', 31 );

function tutoraspire_continue_shopping_button() {
  if ( wp_get_referer() ) echo 'Continue Shopping';
}

You may also like