在 woocommerce 中,是否有查看所有订单的短代码/页面? [英] in woocommerce, is there a shortcode/page to view all orders?

查看:10
本文介绍了在 woocommerce 中,是否有查看所有订单的短代码/页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的 wordpress 网站使用插件 woocommerce,并且需要一个部分,成员可以在其中查看他们的订单历史记录.woocommerce 中是否有显示会员订单历史记录的短代码或页面?

解决方案

我的帐户 简码:

[woocommerce_my_account order_count="-1"]

<块引用>

显示我的帐户"部分,客户可以在其中查看过去的订单并更新他们的信息.您可以指定要显示的数量或顺序,默认设置为 15(使用 -1 显示所有订单.)

参考:Woocommerce 简码

<小时>

更新

如果您只需要订单,我不知道是否已经有简码,但我以 woocommerce_my_account 为例:

function shortcode_my_orders( $atts ) {提取(shortcode_atts(数组('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) );返回 ob_get_clean();}add_shortcode('my_orders', 'shortcode_my_orders');

将此添加到您的 functions.php 文件中,然后像 [my_orders order_counts=10] 一样使用它(order_counts 是可选的,如果缺少它列出了所有订单).

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?

解决方案

My Account shortcode:

[woocommerce_my_account order_count="-1"]

Shows the ‘my account’ section where the customer can view past orders and update their information. You can specify the number or order to show, it’s set by default to 15 (use -1 to display all orders.)

Reference: Woocommerce Shortcodes


Update

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');

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屋!

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