add_filter( 'woocommerce_quantity_input_args', 'rs_woocommerce_quantity_input_args', 10, 2 ); // Simple products
function rs_woocommerce_quantity_input_args( $args, $product ) {
$id = $product->id;
$term_id = 0;
$start = carbon_get_post_meta($id, 'crb_qty_start', $type = null);
$step = carbon_get_post_meta($id, 'crb_qty_step', $type = null);
if (!$start || !$step) {
$term_ids = wc_get_product_term_ids( $id, 'product_cat' );
foreach ($term_ids as $term) {
$start = carbon_get_term_meta($term, 'crb_qty_start', $type = null);
$step = carbon_get_term_meta($term, 'crb_qty_step', $type = null);
$term_id = $term;
}
if (!$start || !$step) {
$child_term = get_term_by('id', $term_id, 'product_cat' );
$start = carbon_get_term_meta($child_term->parent, 'crb_qty_start', $type = null);
$step = carbon_get_term_meta($child_term->parent, 'crb_qty_step', $type = null);
}
}
if (!$start || !$step) {
$start = 1;
$step = 1;
}
if ( is_singular( 'product' ) || is_product_category()) {
$args['input_value'] = $start; // Starting value (we only want to affect product pages, not cart)
}
$args['min_value'] = $start; // Minimum value
$args['step'] = $step; // Quantity steps
return $args;
}
Ну у меня эти данные из carbon fields берутся, тебе надо тогда захардкодить наверное, ну и шаг тебе не нужен