Hiding order status in My Account recent orders list page

帅比萌擦擦* 提交于 2021-02-08 07:34:46

问题


In WooCommerce, I have a Woocommerce site and on the customer's recent orders page, there is a table with order details on this example link: https://example.com/my-account/view-order/

I would like to completely hide order status from the table if possible.

How can I achieve this?

Thanks


回答1:


Updated:

Just use this custom function hooked in woocommerce_my_account_my_orders_columns filter hook:

add_filter('woocommerce_my_account_my_orders_columns', 'custom_removing_order_status', 10, 1);

function custom_removing_order_status( $order ){
    unset($order['order-status']);
    return $order;
}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

No need of editing woocommerce templates. This code is tested and works.




回答2:


You can customize woocommerce/templates/myaccount/my-orders.php template to your theme file.

You will see a variable named "$my_orders_columns". Just remove order-status column from there.

Also, remove it from "$customer_orders" variable, so that it will not unnecessary query to get status.



来源:https://stackoverflow.com/questions/43392110/hiding-order-status-in-my-account-recent-orders-list-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!