简体   繁体   中英

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

    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

Jubrice this code it's great.

I have in my order the number of stock pieces and the number of pieces the customer has ordered.

With your code all pieces over 2 are red. Do you know how to make it so that only pieces purchased by the customer are in red?

Thank you in advance enter image description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM