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

Okay
  Public Ticket #3643333
Hide Bundled Products on Admin Edit Order Page
Open

Comments

  • Cllam Support started the conversation

    Hi, is is possible to hide products that are in the bundles and keep only the main product when adding a bundled product manually on admin's edit order page? For example, A is the main product and B, C are the products bundled inside A. When I create an order manually and add A to the order, I only want A as an order line item. Currently, B, C are also displayed as order line items.

  •  1,223
    Dustin replied

    Hi Cllam,

    You can remove bundled subproducts manually:

    2634768055.png

    OR, you can 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_parent_id' ) ) {
                unset( $items[ $key ] );
            }
        }
        return $items;
    }, 10, 1 );

    Then, bundled subproducts will be removed from all orders in your store.

    Best regards,
    Dustin

  • Cllam Support replied

    Hi Dustin, I tried the custom code and the bundled subproducts were removed successfully. However, the stocks count for each of these products were not deducted.

  •  1,223
    Dustin replied

    You can use another snippet to just hide (not remove) bundled subproducts on the admin orders screen:

    add_filter( 'woocommerce_admin_html_order_item_class', function ( $class, $item ) {
        if ( isset( $item['woosb_parent_id'] ) || isset( $item['_woosb_parent_id'] ) ) {
            return $class . ' woosb-order-item-child';
        }
        return $class;
    }, 99, 2 );
    add_action( 'admin_footer', function () {
        ?>
        <style type="text/css">
            .woosb-order-item-child {
                display: none;
            }
        </style>
        <?php
    }, 99 );

    Best regards,
    Dustin

  • Cllam Support replied

    Hi Dustin,

    The Code Snippet you provided worked when first created an order only. When I tried to remove the main bundled product, the subproducts still remained, and thus their stock still got deducted (see image attached). Is there a way to make the stock of subproducts reacts according to its main product? For example, if I remove the main product, its subproducts also removed. If I increase or decrease the quantity of the main product, its subproducts' quantity also increase or decrease.

    Attached files:  wpc.png

  •  1,223
    Dustin replied

    The backend orders screen provides a flexible edit tool for every product. So, we can't do that.

    You should manually remove or increase the quantity of bundled subproducts.

    Best regards,
    Dustin

  •   Cllam Support replied privately
  •  1,223
    Dustin replied

    We have processed your request and refunded this payment. It's sad to hear that our plugin doesn't meet your requirements.

    Hopefully, we could still have your interest and support of other promising plugins on https://wpclever.net

    Moreover, kindly check out other stunning free plugins from our WPClever team at http://wpclever.org.

    Best regards,
    Dustin