Shirley A
Forum Replies Created
-
Probably not the best way to do this but here ya go.
Update: To be able to delete each component product individually in cart:/plugins/wpc-composite-products/wpc-composite-prducts.php
line: 1620
Comment out line 1625: return ”;
function wooco_cart_item_remove_link( $link, $cart_item_key ) {
if ( isset( WC()->cart->cart_contents[ $cart_item_key ][‘wooco_parent_key’] ) ) {
$parent_key = WC()->cart->cart_contents[ $cart_item_key ][‘wooco_parent_key’];if ( isset( WC()->cart->cart_contents[ $parent_key ] ) ) {
// return ”;
}
}return $link;
}The following will hide the Composite Parent out of the Cart, Email, and Order Details pages BUT the Settings for Component Products MUST be “Hide component products on cart & checkout page: No” and “Hide component products on mini-cart: No”. However, I’m still looking into how to delete these items from cart. This goes in functions.php file in your theme:
// Hide Parent Product on Order Details and Email
function wc_cp_order_item_visible( $visible, $order_item ) {if ( isset( $order_item[‘wooco_ids’] ) ) {
return false;
} else {
return $visible;
}}
// Hide Parent Product on Cart Page
function wc_cp_cart_item_visible( $visible, $cart_item, $cart_item_key ) {if ( function_exists( ‘wooco_init’ ) ) {
$cart_contents_count = get_option( ‘_wooco_cart_contents_count’, ‘composite’ );if( ( $cart_contents_count === ‘component_products’ ) && ! empty( $cart_item[‘wooco_ids’] ) ) {
$visible = false;
return $visible;
} elseif ( $cart_contents_count === ‘component_products’ ) {
return $visible;
}} else {
return $visible;}
}
add_filter( ‘woocommerce_order_item_visible’, ‘wc_cp_order_item_visible’, 10, 2 );
add_filter( ‘woocommerce_widget_cart_item_visible’, ‘wc_cp_cart_item_visible’, 10, 3 );
add_filter( ‘woocommerce_cart_item_visible’, ‘wc_cp_cart_item_visible’ , 10, 3 );
add_filter( ‘woocommerce_checkout_cart_item_visible’, ‘wc_cp_cart_item_visible’, 10, 3 );