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

Okay
  Public Ticket #2372685
Single items showing despite the OFF setting at PDF Invoices & Packing Slips plugin
Closed

Comments

  •  1
    Mike started the conversation

    Greetings, team!

    First of all - great product! Loving it so far. Good job on doing an elegant easy to integrate in any theme plugin, which won't ruin and sit just right in WC WP.

    But there is a plugin we use, called WC PDF & Invoices. I turned off the setting to show single items from the bundle when you add it up to cart and on checkout page as well. All good. But when we do invoices, there are still there:

    1. Bundle name | quanity | $100 (price)

    2. Bundle name > item name | quantity | $0 (price)

    3. Bundle name > item name | quantity | $0 (price)

    I need this just as everywhere else - gone. Points 2 & 3, how can this be done?

    The plugin we use: https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/

  •  767
    Janilyn replied

    Hi Mike, 

    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
    Mike replied

    Hey Janilyn,

    Wow. That was quick. Thanks! Basically, looks like the PDF module takes everything from WC order and pushes it to the .pdf gen function and there are items listed inside with $0 price around them.

    Perhaps there is a way to manipulate the way data gets prepopulated in .pdf file.

  •  1,228
    Dustin replied

    Hi Mike,

    Are you using WPC Product Bundles or WPC Grouped Product? I see you chose the ticket category is WPC Grouped Product but the question about bundlesmile.png

    If it's WPC Product Bundles, please try to add below function 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 ) {
            $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 products
                unset( $data_list[ $key ] );
            }
        }
        return $data_list;
    }

    Best regards,
    Dustin

  •  1
    Mike replied

    Hey Frankie, what a man! Thank you, it worked!

    What if I'll go with

    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 ) {
            $bundled_product = wc_get_order_item_meta( $data['item_id'], '_woosb_parent_id', true );
            if ( ! empty( $bundled_product ) ) {
                // hide bundled product
                unset( $data_list[ $key ] );
            }
        }
        return $data_list;
    }

    What is

    $bundle          = wc_get_order_item_meta( $data['item_id'], '_woosb_ids', true );

    used for?

    Since the aforementioned code in this comment works as well as far as I noticed.

    And yes, I asked about WPC Product Bundles (names look similar though :)

    Mike

  •  1,228
    Dustin replied

    Someone needs to hide the main bundle, keep all bundled productssmile.pngSo, I write the universal function for both.

    In your case, you can remove these lines:

    $bundle = wc_get_order_item_meta( $data['item_id'], '_woosb_ids', true );
    if ( ! empty( $bundle ) ) {
          // hide bundle
          //unset( $data_list[ $key ] );
    }

    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

  •  1
    Mike replied

    Already did. Thank you for chiming in so quick!

  •  1,228
    Dustin replied

    You're welcome!smile.png

    Feel free to submit a new ticket if you have any questions when using our plugin. I'll close this ticket now.

    Best regards,
    Dustin