Support » Plugin: Custom Order Status for WooCommerce » Order color
Order color
-
I setup my custom order status to red but it only shows Gray in the order page… does anyone running into the same issue?
-
Well…
I built something and I’m gonna leave my code here so we can improve it š
– Download this plugin Custom Order Status for WooCommerce
– Create the status you want
– For some reason WOO wasn’t getting the color setup so I had to use funcions.php with the code below:add_action('admin_head', 'styling_admin_order_list' ); function styling_admin_order_list() { global $pagenow, $post; if( $pagenow != 'edit.php') return; // Exit if( get_post_type($post->ID) != 'shop_order' ) return; // Exit ?> <style type="text/css"> .order-status.status-<?php echo sanitize_title('Redeemed'); ?> { background: #00ff00; color: #000; } </style> <?php }?>
– Once you have your status, now you need a CRON to update an order when a Coupon is fully redeemed. I just created a PHP file inside of the Child theme calling it cron.php, code is below:
include("../../../wp-config.php"); $rs = $wpdb->get_results("SELECT ar_posts.post_title AS coupon FROM <code>ar_posts</code> inner join ar_postmeta on ar_posts.ID = ar_postmeta.post_id where ar_posts.post_type = 'shop_coupon' and ar_postmeta.meta_key = 'coupon_amount' AND ar_postmeta.meta_value = 0"); foreach($rs as $ar){ $rsOrder = $wpdb->get_results("SELECT ar_postmeta.meta_value FROM <code>ar_posts</code> inner join ar_postmeta on ar_posts.ID = ar_postmeta.post_id where ar_posts.post_type = 'shop_coupon' and ar_postmeta.meta_key = 'mwb_wgm_giftcard_coupon' and ar_posts.post_title = '".$ar->coupon."' "); foreach($rsOrder as $arOrder){ $orderResult = $wpdb->get_results("SELECT ID FROM <code>ar_posts</code> where post_type = 'shop_order' and ID = ".$arOrder->meta_value." and (post_status = 'wc-completed') "); if(count($orderResult) == 1){ echo "Order ".$arOrder->meta_value."<br>"; $order = new WC_Order($arOrder->meta_value); $order->update_status('wc-redeemed', 'Coupon is fully redeemed'); } } }
Hi @ayrancd,
Thank you for sharing the code.
Regarding the query, it is possible to change the color of the custom order status with the PRO version of the plugin.
However, it is not possible to change the color of the custom status with the free version of the plugin.
Please let us know if you have any further queries.
Regards,
Kenil ShahThe FREE version doesn’t change the color but it has an option to set the color lol
Hi @ayrancd,
Yes, the free version of the plugin does not allow to change the color of the custom order status. Here is the screenshot for your reference: https://prnt.sc/r0jfxl
Regards,
Kenil Shah
- The topic ‘Order color’ is closed to new replies.