• Hi,

    On packing slips and invoices we get both bundled products and the bundled. How can we only show the bundle?

    I found this snippet to only show bundled products

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

    I would like to only show the bundle and its price

    Best Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @nikeri,

    Please try to add below code to your theme (or child-theme) > functions.php

    add_filter( 'wpo_wcpdf_order_items_data', 'woosb_wcpdf_order_items_data' );
    function woosb_wcpdf_order_items_data( $data_list ) {
        foreach ( $data_list as $key => $data ) {
            $bundle          = wc_get_order_item_meta( $data['item_id'], '_woosb_ids', true );
            $bundled_product = wc_get_order_item_meta( $data['item_id'], '_woosb_parent_id', true );
            if ( ! empty( $bundle ) ) {
                // hide bundle
                //unset( $data_list[ $key ] );
            }
            if ( ! empty( $bundled_product ) ) {
                // hide bundled product
                unset( $data_list[ $key ] );
            }
        }
        return $data_list;
    }
    Expand

    Regards,

    Thread Starter nikeri

    (@nikeri)

    Hi,

    Unfortunately that did not work, both bundle and products show on packing slip

    I have the following compatibility settings:
    WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels
    Hide bundles
    No
    Hide bundled products
    Yes

    Best Regards

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove bundled products from Invoice’ is closed to new replies.