Skip to content

eli5wp

  • code snippets

empty cart in nav redirect to shop

June 14, 2021 by emily sparkle
// woo gp - navigation - empty cart redirect to shop
add_action( 'template_redirect', 'empty_cart_redirect' );
function empty_cart_redirect(){
    if( is_cart() && WC()->cart->is_empty() ) {
        wp_safe_redirect( get_permalink( wc_get_page_id( 'shop' ) ) );
        exit();
    }
}
Categories code snippets, generatepress, woocommerce
Post navigation
woo cart change continue shopping button text
woo remove tabs on product page

categories

  • code snippets (57)
    • admin (8)
    • child theme (1)
    • css (9)
    • elementor (1)
    • generatepress (10)
    • htaccess (4)
    • woocommerce (17)
    • wordpress (15)
  • links (4)

topics

admin email cache chrome only comments exclude font awesome google analytics google fonts hacky optimization posts reset responsive shortcode text wp-show-posts

recent

  • woocommerce button color control
  • // GeneratePress Search Box Clear
  • Google API Console
  • DKIM Authentication
  • dreamhost cache settings
© 2022 ASPIRE