Support » Plugin: WPC Composite Products for WooCommerce » Hide Parent Product in Order Confirmation Email

  • Resolved woochilles

    (@woochilles)


    Hello,

    I would like to remove the parent product from the order confirmation email and tried the following code I found in this forum thread in my fuctions.php:

    function wc_cp_order_item_visible( $visible, $order_item ) {
    	if ( isset( $order_item[‘wooco_ids’] ) ) {
    		return false;
    	} else {
    		return $visible;
    	}
    }
    add_filter( ‘woocommerce_order_item_visible’, ‘wc_cp_order_item_visible’, 10, 2 );

    However, this had no effect to the order confirmation email.

    This is an excellent plugin to sell kiteboards and bindings as a composite product. The order confirmation email however can get very confusing because without ordering a binding it appears as if the kiteboard has been listed twice.

    Please suggest a working correction to the function above.

    BR Peter

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WPClever

    (@wpclever)

    Hi @woochilles

    Please try another snippet:

    add_filter( 'woocommerce_order_get_items', 'wooco_exclude_composite_from_order', 10, 1 );
    function wooco_exclude_composite_from_order( $items ) {
    	foreach ( $items as $key => $item ) {
    		if ( $item->meta_exists( 'wooco_ids' ) || $item->meta_exists( '_wooco_ids' ) ) {
    			unset( $items[ $key ] );
    		}
    	}
    
    	return $items;
    }
    Thread Starter woochilles

    (@woochilles)

    Hi @wpclever,

    Many thanks for the custom function! It does exactly what I want.

    Thread Starter woochilles

    (@woochilles)

    Resolved, Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.