在woocommerce中,是否有简码/页面来查看所有订单? [英] in woocommerce, is there a shortcode/page to view all orders?
问题描述
我正在为我的wordpress网站使用woocommerce插件,并且需要一个区域,以便会员可以查看其订购历史记录. woocommerce中是否有任何显示会员订购历史的简码或页面?
I'm using the plugin woocommerce for my wordpress site, and need a section where member can see their order history. Are there any shortcodes or page in woocommerce that shows the order history of a member?
推荐答案
我的帐户短代码:
[woocommerce_my_account order_count="-1"]
显示我的帐户"部分,客户可以在其中查看过去的订单并更新其信息.您可以指定要显示的编号或订单,默认情况下将其设置为15(使用 -1 显示所有订单.)
参考: Woocommerce简码
更新
如果只需要订单,我不知道是否已经有一个简码,但我以woocommerce_my_account为例:
If you need only the orders I don't know if there's already a shortcode, but I made one taking woocommerce_my_account as example:
function shortcode_my_orders( $atts ) {
extract( shortcode_atts( array(
'order_count' => -1
), $atts ) );
ob_start();
wc_get_template( 'myaccount/my-orders.php', array(
'current_user' => get_user_by( 'id', get_current_user_id() ),
'order_count' => $order_count
) );
return ob_get_clean();
}
add_shortcode('my_orders', 'shortcode_my_orders');
将其添加到您的 functions.php 文件中,然后像[my_orders order_counts=10]
一样使用它(order_counts
是可选的,如果缺少它会列出所有订单).
Add this to your functions.php file and then use it like [my_orders order_counts=10]
(order_counts
is optional, if missing it lists all the orders).
这篇关于在woocommerce中,是否有简码/页面来查看所有订单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!