Reputation: 11
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
Upvotes: 0
Views: 171
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