Skip to content

Instantly share code, notes, and snippets.

@rayflores
Last active September 18, 2017 21:55
Show Gist options
  • Save rayflores/a4a0602d04ce5e430c3679989245ed62 to your computer and use it in GitHub Desktop.
Save rayflores/a4a0602d04ce5e430c3679989245ed62 to your computer and use it in GitHub Desktop.
Add Continue Shopping Button to View Cart Message
<?php
/*
Plugin Name: Add Continue Shopping Button for WooCommerce
Plugin URI: https://rayflores.com/add-continue-shopping-button-on-single-product-page/
Description: Add a "Continue Shopping" button to the added to cart message on single product pages
Version: 1.0
Author: Ray Flores
Author URI: https://www.rayflores.com/
*/
add_filter( 'wc_add_to_cart_message_html', 'add_continue_shopping_button', 10, 2);
function add_continue_shopping_button( $message, $products ){
$message .= sprintf( '<br/><a href="%s" class="button wc-forward" style="clear:both;margin-top:5px;">%s</a>', esc_url( wc_get_page_permalink( 'shop' ) ), esc_html__( 'Continue Shopping', 'woocommerce' ) );
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment