-
-
Save DanielSantoro/504322e49b8358d332154ad23c1723f2 to your computer and use it in GitHub Desktop.
Priority Example
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 | |
/** | |
* Changes the redirect URL for the Return To Shop button in the cart. | |
* BECAUSE THIS FUNCTION HAS THE PRIORITY OF 20, IT WILL RUN AFTER THE FUNCTION BELOW (HIGHER NUMBERS RUN LATER) | |
*/ | |
function wc_empty_cart_redirect_url() { | |
return 'http://example.com/category/specials/'; | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url', 20 ); | |
/** | |
* Changes the redirect URL for the Return To Shop button in the cart. | |
* EVEN THOUGH THIS FUNCTION WOULD NORMALLY RUN LATER BECAUSE IT'S CODED AFTERWARDS, THE 10 PRIORITY IS LOWER THAN 20 ABOVE | |
*/ | |
function wc_empty_cart_redirect_url() { | |
return 'http://example.com/shop/'; | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url', 10 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment