Skip to content

Instantly share code, notes, and snippets.

@Willem-Siebe
Created May 23, 2014 08:09
Show Gist options
  • Save Willem-Siebe/c1d70aeef75a3e60ab15 to your computer and use it in GitHub Desktop.
Save Willem-Siebe/c1d70aeef75a3e60ab15 to your computer and use it in GitHub Desktop.
The return to shop button in WooCommerce empty-cart.php goes to the shop archive page. However, if we don't want a shop page and leave this option unset in WooCommerce settings, we need this button to go to our homepage. See http://codex.wordpress.org/Function_Reference/get_home_url. For help on filters see http://dev.themeblvd.com/tutorial/filt…
// The return to shop button in WooCommerce empty-cart.php goes to the shop archive page. However, if we don't want a shop page and leave this option unset in WooCommerce settings, we need this button to go to our homepage. See https://gist.github.com/Willem-Siebe/c1d70aeef75a3e60ab15.
function wsis_woocommerce_return_to_shop_redirect() {
return get_home_url();
}
add_filter( 'woocommerce_return_to_shop_redirect', 'wsis_woocommerce_return_to_shop_redirect' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment