取消的订单显示在“我的帐户"下 - Woocommerce [英] Cancelled order showing under My Account - Woocommerce

查看:26
本文介绍了取消的订单显示在“我的帐户"下 - Woocommerce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运营一个 woocommerce 网站.

I'm running a woocommerce website.

每当客户取消订单时,它都会显示在客户帐户信息页面下.以至于它淹没"了客户已完成的订单,而没有第 2 页、第 3 页"的引用.

whenever a customer cancels an order, it shows up under the customers account information page. to the point it "drowns out" the completed orders the customer has made, without a "page 2, page 3" reference.

换句话说,在取消了如此多的订单后,客户将无法看到他订购的东西和按订单完成的东西.

in other words, after so many canceled orders, the customer won't be able to see what the hokey he's ordered and completed as ordered in the first place.

所以我的问题是,

有没有办法为我的客户从我的帐户"下显示的取消"订单中删除?并且只显示已完成的订单?

IS there a way to remove "canceled" orders from showing under "my account" for my customer? and only show completed orders?

或添加第 2 页、第 3 页,(增加每页显示的最大订单数?)

or add a page 2, page 3, (increasing the maximum number of orders shown per page?)

这是一个woocommerce问题.....

This is a woocommerce Question.....

ps.我一直在看我的帐户.php我的订单.php

ps. i've been looking at my-account.php my-orders.php

答案肯定是在编辑 my-orders.php....

the answer is definitely in editing my-orders.php....

谢谢!

推荐答案

答案在 my-orders.php 中.您需要使用 woocommerce_my_account_my_orders_query 过滤器

The answer lies in my-orders.php. You need to use woocommerce_my_account_my_orders_query filter

将以下代码添加到主题的functions.php

Add the following code to your theme's functions.php

add_filter( 'woocommerce_my_account_my_orders_query', 'custom_my_orders' );
function custom_my_orders( $args ) {

    if (($key = array_search('wc-cancelled', $args['post_status'])) !== false) {
        unset($args['post_status'][$key]);
    }
    return $args;
}

这是订单类型列表:

Array ( [0] => wc-pending [1] => wc-processing [2] => wc-on-hold [3] => wc-completed [4] => wc-cancelled [5] => wc-refunded [6] => wc-failed [7] => wc-shipped ) 

这篇关于取消的订单显示在“我的帐户"下 - Woocommerce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆