• Resolved danlopes

    (@danlopes)


    I have a problem.
    I have two units of measure in my store (unit and weight).
    I tried to put the information right after the input according to the unit.
    I would like to have both units as shown.
    I tried to use the function below, but it didn’t work.
    I need to put a background according to the category. Thanks

    add_filter( 'woocommerce_quantity_input_args', 'min_qty_filter_callback',  20, 2 );
    
    function min_qty_filter_callback( $args, $product ) {
    $category = 17; // The targeted product category
    $min_qty  = 1; // The minimum product quantity
    
    $product_id = $product->is_type('variation') ? $product->get_parent_id() : $product->get_id();
    
    if( has_term( $category, 'product_cat', $product_id ) ){
        $args['min_value'] = $min_qty;
        $args['step'] = 1;
        $args['backgroud'] = 'FFFFFF';
    }
    
    return $args;
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Two units of measure Units and Weight (Woocommerce)’ is closed to new replies.