Last active
May 20, 2020 12:16
-
-
Save szlegradi/a8562ed655e8daf610db2b75c8650d70 to your computer and use it in GitHub Desktop.
WooCommerce kosár átirányítása az Üzlet vagy Pénztár oldalra
This file contains 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 | |
add_action( 'template_redirect', 'redirect_cart_to_checkout' ); | |
function redirect_cart_to_checkout() { | |
if ( is_cart() ) { | |
if ( empty( WC()->cart->get_cart_contents() ) ) { | |
wp_redirect( wc_get_page_permalink( 'shop' ) ); | |
} else { | |
wp_redirect( wc_get_page_permalink( 'checkout' ) ); | |
} | |
die(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment