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

Okay
  Public Ticket #2374448
PDF Invoice Product Detail
Closed

Comments

  • Ariel Peteri started the conversation

    How can I Hide the Bundled Products for the PDF Invoices (I've tried different PDF INVOICES plugins, but I gues is bc how WPC is inputing the information). I could do this for the checkout and for the cart, but it doesent have an option for the PDF INVOICES.

  •  767
    Janilyn replied

    Hi Ariel, 

    Thank you for contacting WPClever Support Forum. 

    We’ve received your ticket and assigned one of our developers to help you with that. 

    He’ll be looking into your question and responding with specific instructions as soon as possible. Please stay in touch as he might need discuss further with you. 

    Best regards.

    Janilyn T. - WPClever Support Agent

  •  1,228
    Dustin replied

    Hi Ariel,

    Please try this plugin https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/

    Then add below code to current 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 ) {
            $bundles = wc_get_order_item_meta( $data['item_id'], '_woosb_ids', true );
            $bundled = wc_get_order_item_meta( $data['item_id'], '_woosb_parent_id', true );
            if ( ! empty( $bundles ) ) {
                // hide bundles
                //unset( $data_list[ $key ] );
            }
            if ( ! empty( $bundled ) ) {
                // hide bundled
                unset( $data_list[ $key ] );
            }
        }
        return $data_list;
    }

    If you use another PDF Invoice plugin, please send me this plugin then I can check and provide the code.

    Best regards,
    Dustin

  • Ariel Peteri replied

    Thank you Frankie, The plug in  I am Currently using is:  

    WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels (Basic)
    https://wordpress.org/plugins/print-invoices-packing-slip-labels-for-woocommerce/

  •  1,228
    Dustin replied

    Please use below code instead:

    // invoice
    add_filter( 'wf_pklist_alter_order_items', 'woosb_wf_pklist_alter_order_items', 99, 1 );
    function woosb_wf_pklist_alter_order_items( $order_items ) {
        foreach ( $order_items as $order_item_id => $order_item ) {
            if ( $order_item->meta_exists( '_woosb_parent_id' ) ) {
                unset( $order_items[ $order_item_id ] );
            }
        }
        return $order_items;
    }
    // package
    add_filter( 'wf_pklist_alter_package_order_items', 'woosb_wf_pklist_alter_package_order_items', 99, 1 );
    function woosb_wf_pklist_alter_package_order_items( $order_package ) {
        foreach ( $order_package as $order_package_key => $order_package_item ) {
            if ( isset( $order_package_item['extra_meta_details'], $order_package_item['extra_meta_details']['_woosb_parent_id'] ) ) {
                unset( $order_package[ $order_package_key ] );
            }
        }
        return $order_package;
    }
    // meta data
    add_filter( 'wf_pklist_modify_meta_data', 'woosb_wf_pklist_modify_meta_data', 99, 1 );
    function woosb_wf_pklist_modify_meta_data( $meta_data ) {
        if ( array_key_exists( '_woosb_ids', $meta_data ) || array_key_exists( '_woosb_parent_id', $meta_data ) ) {
            $meta_data = array();
        }
        return $meta_data;
    }

    Best regards,
    Dustin

  • Ariel Peteri replied

    Should I use this code on the Child Theme or in that plug in? In Any case, I should paste it at the end of the code?


    Thanks.

  •  1,228
    Dustin replied

    Please add this code to the end of current theme (or child-theme) / functions.php

    Best regards,
    Dustin

  • Ariel Peteri replied

    It Worked!!!! thank you so much!!!

  •  1,228
    Dustin replied

    You're welcome!smile.png

    If you are satisfied with our plugin and support, please reward it with a full five-star ★★★★★ rating.
    https://wordpress.org/support/plugin/woo-product-bundle/reviews?rate=5#new-post 
    Thank you in advance! <3

    Best regards,
    Dustin