Support » Plugin: YITH WooCommerce Product Bundles » Minimum order e YITH WooCommerce Product Bundles

  • Hi Thanks for the form,
    it works perfectly, in my eshop I have inserted a function in the fuction file to set minimum orders of 6 pieces, but although I have made a pack with 3 bottles as soon as I insert 2 packs so he tells me that I have not reached the correct number anyway! which instead works if I insert 6 bottles individually I attach site link and entered codeHi Thanks for the form,
    it works perfectly, in my eshop I have inserted a function in the fuction file to set minimum orders of 6 pieces, but although I have made a pack with 3 bottles as soon as I insert 2 packs so he tells me that I have not reached the correct number anyway! which instead works if I insert 6 bottles individually I attach site link and entered code
    Thanks

    Site https://sorbara-pietrapennata.it/prodotto/tris-3-bottiglie/

    Code Fuction

    add_action( ‘woocommerce_checkout_process’, ‘wpspecial_imposta_ordine_minimo_prodotti’ );
    add_action( ‘woocommerce_before_cart’ , ‘wpspecial_imposta_ordine_minimo_prodotti’ );
    add_action( ‘woocommerce_before_checkout_form’, ‘wpspecial_imposta_ordine_minimo_prodotti’ );
    function wpspecial_imposta_ordine_minimo_prodotti() {
    // Specifica l’ordine minimo dei prodotti da acquistare
    $minimo_prodotti = 6;

    if ( WC()->cart->cart_contents_count < $minimo_prodotti ) {

    if( is_cart() ) {

    wc_print_notice(
    sprintf( ‘Devi acquistare almeno %s prodotti per completare un ordine, attualmente hai %s prodotti nel carrello.’ ,
    $minimo_prodotti,
    WC()->cart->cart_contents_count
    ), ‘error’
    );

    } else {

    wc_add_notice(
    sprintf( ‘Devi acquistare almeno %s prodotti per completare un ordine, attualmente hai %s prodotti nel carrello.’ ,
    $minimo_prodotti,
    WC()->cart->cart_contents_count
    ), ‘error’
    );

    }
    }
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there,

    Try to replace:

    WC()->cart->cart_contents_count

    with:

    WC()->cart->get_cart_contents_count()

    • This reply was modified 9 months ago by YITHEMES.
    • This reply was modified 9 months ago by YITHEMES.
Viewing 1 replies (of 1 total)
  • The topic ‘Minimum order e YITH WooCommerce Product Bundles’ is closed to new replies.