• Resolved tipomarwan

    (@tipomarwan)


    Hello
    great plugin
    i’ve a question
    is possible to allow minimun quantity only on backorders?

    i mean
    i’ve in stock 10, you order 3 OK
    i’ve in stock 3, you order 3 OK
    i’ve in stock 2, you order 3 STOP Minimun quantity 5

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ashok G

    (@wpashokg)

    @tipomarwan, it’s a different logic.

    Thread Starter tipomarwan

    (@tipomarwan)

    So it’s impossible todo?
    No way?
    ??

    Plugin Author Ashok G

    (@wpashokg)

    @tipomarwan I’ve a question,

    if the available qty is less than the min buy qty, customer should be able to buy the available quantity / it should throw notification that stock is less than the min buy qty ?

    Thread Starter tipomarwan

    (@tipomarwan)

    Hi
    thanks for question

    i’ve resolved by this workaround
    i’ve set a flag in product page ($mminEnable == ‘yes’) to allow minimun quantity to 5 for selected product

    then added this code to functions.php

    /*
    * Changing the minimum quantity to 5 for all backordered WooCommerce products
    */

    function woocommerce_quantity_input_min_callback( $min, $product ) {
    global $post;
    $mminEnable = get_post_meta( $post->ID, ‘is_minqty5’, true );
    if ( $product->managing_stock() && $product->is_on_backorder( 1 ) && $mminEnable == ‘yes’){
    $min = 5;
    }
    return $min;
    }
    add_filter( ‘woocommerce_quantity_input_min’, ‘woocommerce_quantity_input_min_callback’, 10, 2 );

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Minimum quantity on backorder only’ is closed to new replies.