Last active
May 22, 2019 11:01
-
-
Save rafsuntaskin/2e88444a507e7301615c568d5504f828 to your computer and use it in GitHub Desktop.
Woo Empty cart return to Events Calendar
This file contains hidden or 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
<?php | |
/** | |
* WooCommerce alter Shop redirect from cart to Events Calendar | |
* | |
* @author Rafsun Chowdhury | |
* | |
* @link https://gist.github.com/rafsuntaskin/2e88444a507e7301615c568d5504f828 | |
* | |
*/ | |
add_filter( 'woocommerce_return_to_shop_redirect', 'rt_custom_cart_redirect_shop_url' ); | |
/** | |
* Filter the redirect URL | |
* | |
* @param $url | |
* | |
* @return string | |
*/ | |
function rt_custom_cart_redirect_shop_url( $url ) { | |
if ( class_exists( 'Tribe__Events__Main' ) ) { | |
$main = Tribe__Events__Main::instance(); | |
$url = $main->getLink('home'); | |
} | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment