Jubrice
Jubrice

Reputation: 11

Woocommerce admin panel - color quantity >2

I create this message because I can not find my answer ... I am looking for a way that in woocommerce, when a person orders a quantity greater than 2, the number of the quantity is highlighted in a color.

I put a screenshot to show what screen I'm talking about in woocommerce.

My request is not complicated but I can't find any way to do it...

Thanks in advance

admin panel order

Upvotes: 0

Views: 171

Answers (1)

mujuonly
mujuonly

Reputation: 11841

    add_action('admin_footer', function () {

        echo <<<'EOT'
<script type="text/javascript">
    jQuery(function($){
    var qty_string = $("#order_line_items .quantity .view").html();
    var qty_amount = qty_string.charAt(qty_string.length-3);
    if( qty_amount > 2 ){
     $("#order_line_items .quantity .view").css("color", "red");
    }
    });
</script>
EOT;
    }, 99999);
    

Add the below code to your active theme functions.php file

Upvotes: 2

Related Questions