Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
September 15, 2022 at 9:52 am #1365086
Hi guys,
do you have a code for me how to edit the woocommerce custom order status?
I want to delete some e.g. on-hold or at shipping.Thanks and Greetings
September 15, 2022 at 10:54 am #1365101Hey mary301187,
Thank you for the inquiry.
You can use the wc_order_statuses filter from the wc_get_order_statuses function (below) to adjust the available statuses but we are not sure how will the changes affect the order process.
/** * Get all order statuses. * * @since 2.2 * @used-by WC_Order::set_status * @return array */ function wc_get_order_statuses() { $order_statuses = array( 'wc-pending' => _x( 'Pending payment', 'Order status', 'woocommerce' ), 'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ), 'wc-on-hold' => _x( 'On hold', 'Order status', 'woocommerce' ), 'wc-completed' => _x( 'Completed', 'Order status', 'woocommerce' ), 'wc-cancelled' => _x( 'Cancelled', 'Order status', 'woocommerce' ), 'wc-refunded' => _x( 'Refunded', 'Order status', 'woocommerce' ), 'wc-failed' => _x( 'Failed', 'Order status', 'woocommerce' ), ); return apply_filters( 'wc_order_statuses', $order_statuses ); }Example:
add_filter('wc_order_statuses', function($statuses) { $statuses['wc-custom-status'] = _x( 'Custom', 'Custom status', 'woocommerce' ), return $statuses; }, 10, 1);Best regards,
IsmaelSeptember 15, 2022 at 11:41 am #1365108Hey Ismael,
I paste it info the function.php child theme but nothing happened.
Can you please explain me exactly what to do?Thank you so much
September 16, 2022 at 10:07 am #1365222Hi,
Thank you for the update.
Did you add the filter?
add_filter('wc_order_statuses', function($statuses) { $statuses['wc-custom-status'] = _x( 'Custom', 'Custom status', 'woocommerce' ); return $statuses; }, 10, 1);After adding the filter, try to edit any of the existing orders and set its status to “Custom status”.
Best regards,
Ismael -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
