Created
March 30, 2016 10:34
-
-
Save SiR-DanieL/7fd8ec2e4443abf792100ddf58b311c9 to your computer and use it in GitHub Desktop.
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
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 ); | |
add_action( 'woocommerce_proceed_to_checkout', 'change_url_to_checkout', 20 ); | |
function change_url_to_checkout() { | |
$cart = WC()->cart->get_cart(); | |
$url = ''; | |
foreach ( $cart as $item ) { | |
if ( $item['product_id'] === 70 ) { | |
$url = 'put_your_extra_page_url_here'; | |
break; | |
} | |
} | |
if ( empty( $url ) ) { | |
return; | |
} | |
?> | |
<a href="<?php echo esc_url( $url ); ?>" class="checkout-button button alt wc-forward">Your checkout</a> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment