• 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 2 replies - 1 through 2 (of 2 total)
  • Plugin Support mouli a11n

    (@mouli)

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not heard back from you in a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Two units of measure Units and Weight (Woocommerce)’ is closed to new replies.