1
1
13ffingers2021-03-31 09:06:55
WooCommerce
13ffingers, 2021-03-31 09:06:55

How to sell fractional quantity of product of certain WooCommerce categories?

I have a working code, but I need fractional values ​​for all products except for certain ones, for example - ID: 738.

function min_decimal($val) {
    return 1; // Минимальное значение
}

add_filter("woocommerce_quantity_input_min", "min_decimal");

function step_decimal($val) {
    return 0.1; // Шаг    
}

add_filter("woocommerce_quantity_input_step", "step_decimal");

// Удаление и добавление своего фильтра проверки количества

remove_filter("woocommerce_stock_amount", "intval");
add_filter("woocommerce_stock_amount", "floatval");


Please help with solving the problem.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question