如何删除WooCommerce订单状态? [英] How to remove WooCommerce order status?
问题描述
我想修改woocommerce中包含的功能。这是我编辑的函数( woocommerce / includes / wc-order-functions.php
):
函数wc_get_order_statuses(){
$ order_statuses = array(
'wc-pending'=> _x('等待支付','订单状态','woocommerce'),$ b'b / *'wc-processing'=> _x('处理','订单状态','woocommerce'),* /
'wc-on-hold'=> _x ','订单状态','woocommerce'),
'wc-completed'=> _x('完成','订单状态','woocommerce'),
'wc-canceled'= > _x('已取消','订单状态','woocommerce'),
'wc-refunded'=> _x('已退款','订单状态','woocommerce'),
'wc-failed'=> _x('失败','订单状态','woocommerce'),
);
返回apply_filters('wc_order_statuses',$ order_statuses);
}
我试图在函数中加载一个新函数.php
文件在儿童主题中,但似乎不起作用。
我想要实现的是消除订单项Processing 从状态菜单。我也试过使用CSS,但不支持
选择选项[value =wc-processing] {display:none!重要;}
您需要使用过滤器。曾几何时,我写了一篇我认为是一本很好的教程,讲解了 WordPress过滤器
在这种情况下,最终结果是:
函数so_39252649_remove_processing_status ($ stats){
if(isset($ statuses ['wc-processing'])){
unset($ statuses ['wc-processing']);
}
返回$状态;
}
add_filter('wc_order_statuses','so_39252649_remove_processing_status');
请记住,处理状态是创建订单时的默认状态,因此您可以必须进行其他更改以补偿其删除。
I would like to modify a function contained in woocommerce. This is my edited function (woocommerce/includes/wc-order-functions.php
):
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 );
}
I tried to load a new function within the function.php
file in the child theme, but does not seem to work.
what I want to achieve is to eliminate the order item "Processing" from the status menu. I also tried with css but those do not support
select option[value="wc-processing"] {display: none !important;}
You need to use filters. Once upon a time, I wrote what I think is a good tutorial explaining WordPress filters
In this case, the end result would be:
function so_39252649_remove_processing_status( $statuses ){
if( isset( $statuses['wc-processing'] ) ){
unset( $statuses['wc-processing'] );
}
return $statuses;
}
add_filter( 'wc_order_statuses', 'so_39252649_remove_processing_status' );
Keep in mind, that the processing status is the default status when an order is created, so you may have to make other changes to compensate for it's removal.
这篇关于如何删除WooCommerce订单状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!