Skip to content

Instantly share code, notes, and snippets.

@rafsuntaskin
Last active May 22, 2019 11:01
Show Gist options
  • Save rafsuntaskin/2e88444a507e7301615c568d5504f828 to your computer and use it in GitHub Desktop.
Save rafsuntaskin/2e88444a507e7301615c568d5504f828 to your computer and use it in GitHub Desktop.
Woo Empty cart return to Events Calendar
<?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