• Mike-bd

    (@mikekharisma)


    Hi
    I’m using your plugin which is great, but I have one major issue.

    I have a minimum order quantity on check out, but the bundled products counts as only one item in check out instead of the number of items in the bundle.

    I really need the number of items I have in a bundle to be counted in the basket quantity??

    Many Thanks
    Mike

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi Mike,

    no, I’m sorry but you want it’s not possible because the bundle, like you write before, is a single product.

    However, I think you can use the hook woocommerce_cart_contents_count to reach your goal.
    First of all you need to remove the customization added by our bunlde plugin and then with the same hook remove the bundle and use only the bundle item in cart.

    Please, try to add this snippet of PHP code at the end of fucntions.php file located in the main root of your theme:

    if ( !is_admin() && function_exists( 'YITH_WCPB_Frontend' ) && !function_exists( 'yith_wcbp_customization_remove_bundles_from_cart_count' ) ) {
        remove_filter( 'woocommerce_cart_contents_count', array( YITH_WCPB_Frontend(), 'woocommerce_cart_contents_count' ), 10 );
        add_filter( 'woocommerce_cart_contents_count', 'yith_wcbp_customization_remove_bundles_from_cart_count', 10, 1 );
    
        function yith_wcbp_customization_remove_bundles_from_cart_count( $count ) {
            $cart_contents = WC()->cart->cart_contents;
    
            $bundle_count = 0;
            foreach ( $cart_contents as $cart_item_key => $cart_item ) {
                if ( !empty( $cart_item[ 'cartstamp' ] ) ) {
                    $bundle_count += $cart_item[ 'quantity' ];
                }
            }
    
            return intval( $count - $bundle_count );
        }
    }

    Let me know

    Thread Starter Mike-bd

    (@mikekharisma)

    Works like a dream!! ?? Many many thanks.
    Mike

    Plugin Author YITHEMES

    (@yithemes)

    ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Minimum Quantities’ is closed to new replies.