Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4543965
Custom code to remove main bundle on order
Open

Comments

  • Kjetil Toth started the conversation

    Hi,

    I use WPC Product Bundles Pro on several web sites.
    The plugin works fine. When customer place an order is shows main bundle and also all products.
    All my orders are transfered to a MASTER site. The master site do not contain any bundle products, so I would like to hide the main bundle products and only show the sub products.
    This makes it easyer for the warehouse to pack the order when the main bundle is hidden from the order.
    The order confirmation to the customer is sent from CHILD stor, and this contains the main bundle incl sub products. 

    Im only using the code on my MASTER site. See picture for how the order is on MASTER site. You can see that the main bundle does not contain any SKU and is not highlighted. So I need to HIDE this line so the workers that pack the order does not get confused. 

    Attached files:  2026-02-17 12_45_50-Greenshot.png

  •  1,633
    Dustin replied

    Hi Kjetil,

    Please add the custom code below. (How to add custom code? ↗):

    add_filter( 'woocommerce_order_get_items', function ( $items ) {
    	foreach ( $items as $key => $item ) {
    		if ( $item->meta_exists( '_woosb_ids' ) || $item->meta_exists( 'woosb_ids' ) ) {
    			unset( $items[ $key ] );
    		}
    	}
    
    	return $items;
    } );

    It will hide the main product bundle from the order details.

    Best regards,
    Dustin