Hi. How can we help?

Deposit and Down Payments with WooCommerce Bundles

Add the following code on functions.php in order to fix a compatibility on total cart when a bundle product is added to the cart with deposits.

if( defined( 'YITH_WCDP' ) && ! function_exists( 'yith_wcdp_add_deposit_for_bundles' ) ){
function yith_wcdp_add_deposit_for_bundles(){
add_action( 'woocommerce_before_add_to_cart_button', array( YITH_WCDP_Frontend_Premium(), 'print_single_add_deposit_to_cart_template' ) );
}
add_action( 'yith_wcdp_bundle_add_to_cart', 'yith_wcdp_add_deposit_for_bundles' );
}

if( defined( 'YITH_WCDP' ) && ! function_exists( 'yith_wcd_skip_deposit_when_bundle_item' ) ){
function yith_wcd_skip_deposit_when_bundle_item( $process, $cart_item ){
if( isset( $cart_item['bundled_by'] ) ){
return false;
}
return $process;
}
add_filter( 'yith_wcdp_process_cart_item_product_change', 'yith_wcd_skip_deposit_when_bundle_item', 10, 2 );
}

if( defined( 'YITH_WCDP' ) && ! function_exists( 'yith_wcd_skip_deposit_meta_when_bundle_item' ) ){
function yith_wcd_skip_deposit_meta_when_bundle_item( $process, $cart_item_data ){
if( isset( $cart_item_data['bundled_by'] ) ){
return false;
}
return $process;
}
add_filter( 'yith_wcdp_process_deposit', 'yith_wcd_skip_deposit_meta_when_bundle_item', 10, 2 );

if( class_exists( 'WC_PB_Cart' ) && ! function_exists( 'yith_wcdp_remove_bundle_handling' ) ){
function yith_wcdp_remove_bundle_handling(){
remove_action( 'woocommerce_add_to_cart', array( WC_PB_Cart::instance(), 'bundle_add_to_cart' ), 10 );
}
add_action('yith_wcdp_before_add_to_support_cart', 'yith_wcdp_remove_bundle_handling');
}
Was this article helpful?
1 out of 1 found this helpful

Back to Help Center >

Powered by Zendesk