Created
November 11, 2019 02:55
-
-
Save madeincosmos/6e520711a572209d44f864a6811e41ec to your computer and use it in GitHub Desktop.
Check if product add-ons are in cart
This file contains hidden or 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
add_action( 'woocommerce_before_calculate_totals', 'custom_calculate_shipping_date_based_on_addons' ); | |
function custom_calculate_shipping_date_based_on_addons() { | |
$cart_contents = WC()->cart->cart_contents; | |
foreach ( $cart_contents as $cart_item_key => $cart_item_data ) { | |
if ( ! empty( $cart_item_data['addons'] ) ) { | |
// addons in cart, add your code here | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment