Condition check in woocomerce order status
-
Im trying to make a progress bar for woocommerce which will output % on a order status,
Like if order is processing it will output 50%, if order status is shipping(custom order status) then it will be 70% and so on.
so for this i am thinking to do something like this
if (woocommerce_order_status == “processing”){ echo “50%” } or
if (woocommerce_order_status_processing == 1){ echo “50%” }
but i dont know how to condition check the order status.
i got it working with
<?php $customer_orders = get_posts( apply_filters( 'woocommerce_my_account_my_orders_query', array( 'numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => wc_get_order_types( 'view-orders' ), 'post_status' => array_keys( wc_get_order_statuses() ) ) ) ); if ( $customer_orders ) : ?> <table class="shop_table shop_table_responsive my_account_orders"> <tbody> <?php foreach ( $customer_orders as $customer_order ) : $order = wc_get_order( $customer_order ); $item_count = $order->get_item_count(); ?> <tr class="order"> <?php $status = new WC_Order_Status_Manager_Order_Status( $order->get_status() ); $name = $status->get_name(); $comparename = 'Reviewing'; $Shipping = 'Shipping'; if ($name == $comparename) { echo wc_get_order_status_name( $order->get_status() ); } if ($name == $Shipping) { echo wc_get_order_status_name( $order->get_status() ); } ?> </tr> <?php endforeach; ?> </tbody> </table> <?php endif; ?>
but i think this isnot the right way to do it if someone can provide right code/example then that would be great ??
- The topic ‘Condition check in woocomerce order status’ is closed to new replies.