Created
November 25, 2014 22:35
-
-
Save lmartins/6a5673569953d2cc45ef to your computer and use it in GitHub Desktop.
Custom Add to Cart message and Continue to Shop link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_add_to_cart_message', 'woocommrece_custom_add_to_cart_message' ); | |
function woocommrece_custom_add_to_cart_message() { | |
global $woocommerce; | |
// Output success messages | |
if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) { | |
$return_to = get_permalink( woocommerce_get_page_id( 'shop' ) ); // Give the url, you want to redirect | |
$message = sprintf( '<a href="%s" class="button">%s</a> %s', $return_to, __( 'More Donation Options →', 'woocommerce' ), __( 'Donation successfully added to your cart.', 'woocommerce' ) ); | |
} else { | |
$message = sprintf( '<a href="%s">%s</a> %s', get_permalink( woocommerce_get_page_id( 'cart' ) ), __( 'View Cart →', 'woocommerce' ), __( 'Donation successfully added to your cart.', 'woocommerce' ) ); | |
} | |
return $message; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment