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' ) ); | |
} |
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 | |
function bbloomer_add_gift_if_sku_added_cart( $passed, $product_id, $quantity ) { | |
global $woocommerce; | |
/* enter array of SKUs that give gift */ | |
$skuswithgift = array('KCF-N-ATC', 'armsup'); | |
/* enter SKU of product gift */ | |
$giftsku = 'ajandek'; |
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 | |
function bbloomer_add_gift_if_sku_added_cart( $passed, $product_id, $quantity ) { | |
global $woocommerce; | |
/* enter array of SKUs that give gift */ | |
$skuswithgift = array('KCF-N-ATC', 'armsup'); | |
/* enter SKU of product gift */ | |
$giftsku = 'ajandek'; |