Here it the working code and you need to add this into your functions.php file:
WOOCOMMERCE HOOK- CART: REDIRECT EMPTY CART TO EMPTY CART PAGE
add_action("template_redirect", 'redirection_function');
function redirection_function()
{
global $woocommerce, $woocommerce_errors;
if (is_cart() && sizeof($woocommerce->cart->cart_contents) == 0)
{
wp_safe_redirect(get_permalink(get_page_by_path('cart/cart-empty')));
}
}
WOOCOMMERCE HOOK- CART: REDIRECT EMPTY CART TO EMPTY CART PAGE
add_action("template_redirect", 'redirection_function');
function redirection_function()
{
global $woocommerce, $woocommerce_errors;
if (is_cart() && sizeof($woocommerce->cart->cart_contents) == 0)
{
wp_safe_redirect(get_permalink(get_page_by_path('cart/cart-empty')));
}
}
Thank you for sharing excellent information. Your website is very cool. Fully useful your blog post... Online shopping website in india
ReplyDelete