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

Okay
  Public Ticket #3512286
How to let only the bundled products appear in the order details?
Closed

Comments

  •  1
    Paulo Lemos started the conversation

    Hello! I'm super happy using the plugin, but I'm facing a challenge when I export the orders to my invoice system. They see the bundle info as an item, creating an error in the system. is there a way to remove the bundle name(and price) from the order page, and set the discount price as a literal discount (and not as a negative number in an item price)?

  •  767
    Janilyn replied

    Hi Paulo,

    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 patient as we're having very heavy workloads, it might take some time for our developers to reach back.

    Best regards.

    Janilyn T. - WPClever Support Agent

  •  1,225
    Dustin replied

    Hi Paulo,

    Please add the below custom code (How to add custom code?)

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

    Best regards,
    Dustin

  •  1
    Paulo Lemos replied

    Thanks, Dustin!

    We are almost there! But I need to have the discount amount described in the order's page (or in each item). The way it's now, it goes to the receipts app with full item's price (without any described discount), making the total order with the wrong paid value. is that possible?

    thanks again!

  •  1,225
    Dustin replied

    It's quite complex to generate a bundle's discount as a discount code, especially when many different bundles are added to the cart.

    You can try using a discount percentage instead of an amount for bundles.

    Best regards,
    Dustin

  •  1
    Paulo Lemos replied

    Thanks, again, Dustin!

    one last question. is there a code to hide the bundled products instead of the bundle name (and price)? I think I found a way to add the bundle specification in the receipts app, so they can do the individual item calculation there.

    thanks!

  •  1,225
    Dustin replied

    To hide bundled sub-products, please use the below snippet instead of the previous one.

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

    Best regards,
    Dustin

  •  1
    Paulo Lemos replied

    Thanks, Dustin! I've replaced the code, but the bundle price appear as negative discount, instead of the full bundle price. do you think there's a way to have the full bundle price?

    I've attached a screenshot so you can see.

    thanks!

    Attached files:  Screen Shot 2023-11-06 at 10.02.39.png

  •  1,225
    Dustin replied

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

    add_action( 'woocommerce_checkout_create_order_line_item', function ( $order_item, $cart_item_key, $values ) {
        if ( ! empty( $values['woosb_ids'] ) && ! empty( $values['woosb_price'] ) ) {
            $order_item->set_subtotal( (float) $values['woosb_price'] );
            $order_item->set_total( (float) $values['woosb_price'] * (float) $values['quantity'] );
        }
        if ( ! empty( $values['woosb_parent_id'] ) ) {
            $order_item->set_subtotal( 0 );
            $order_item->set_total( 0 );
        }
    }, 99, 3 );

    Best regards,
    Dustin

  •  1
    Paulo Lemos replied

    Thanks! it worked! awesome client support.

  •  1,225
    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! ♥

    Best regards,
    Dustin

  •  1
    Paulo Lemos replied

    Just did it! and one more question:

    I need to export my orders in xls to send it daily to our team, in that case I need to have all bundled items displayed. After adding the code you've sent me (that works perfectly for the orders page), they come out empty. In my export plugin, I have the option to add a php code to process. is there a way to add a code to undo the 'unset' code for ''_woosb_parent_id'? in that case, to return all the bundled products info to its original state?

  •  1,225
    Dustin replied

    Please give me the name of the export plugin then I can help you check it. If it's a premium plugin, please send me the installation file (.zip).

    Best regards,
    Dustin

  •  1
    Paulo Lemos replied

    the plugin name is "Advanced Order Export For WooCommerce".

    there's a specific field for php code injection.

  •  1,225
    Dustin replied

    Hi Paulo,

    I think we should jump to the starting point.

    We'll hide bundled sub-products for your "invoice system" only.  Instead of using this snippet https://app.screencast.com/6OIDsJq5nxWLL, you can enable this option https://app.screencast.com/mpoaLpRAOK4J8. Now the bundled sub-products still appear in your website backend and the order export plugin.

    Best regards,
    Dustin