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

Okay
  Public Ticket #4508262
Hiding sub products - stock not deducting
Open

Comments

  • Janus started the conversation

    Hi I have read other posts referring to this snippet

    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 );
    

    I am using this to hide sub products on our admin orders, invoicing system etc.

    But we are experiencing issues with that stock for the sub products are not changing when this code is active.

    How can we make it work so sub products are still hidden, but that the stock function still works?

  •  1,565
    Dustin replied

    Hi Janus,

    The admin orders are for accounting and statistics purposes, so you should not hide the child products.

    For the invoicing system, you can check the options in the Compatible tab. If you use another plugin, let me know.

    9530980004.png

    In that case, please renew your license, as the old one, purchased on February 16, 2024, has expired for support.

    Best regards,
    Dustin

  • Janus replied

    We are using an external warehouse system called Shipmondo.dk which fetches the order data through the rest api with this plugin: https://wordpress.org/plugins/pakkelabels-for-woocommerce/

    So is it possible to exclude the sub products in the rest api?

  •  1,565
    Dustin replied

    If that plugin only gets the product information that needs to be shipped, you can try this option in each bundle:

    5503719456.png

    Let me know if it works as expected.

    Best regards,
    Dustin

  •   Janus replied privately
  •  1,565
    Dustin replied

    You can try contacting the author of the Shipmondo plugin (https://wordpress.org/plugins/pakkelabels-for-woocommerce/) to ask about this issue. They know their plugin well and will easily have a solution.

    Our plugin added additional metadata to identify which child products are bundled.

    On cart items, check $cart_item['woosb_parent_id'] and remove that item.

    On order items, check $order_item->get_meta( '_woosb_parent_id' ) and remove that item.

    Best regards,
    Dustin