• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wc_get_orders函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wc_get_orders函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_orders函数的具体用法?PHP wc_get_orders怎么用?PHP wc_get_orders使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wc_get_orders函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_order_refunds

 /**
  * Get the order refunds for an order
  *
  * @since 2.2
  * @param string $order_id order ID
  * @param string|null $fields fields to include in response
  * @return array
  */
 public function get_order_refunds($order_id, $fields = null)
 {
     // Ensure ID is valid order ID
     $order_id = $this->validate_request($order_id, $this->post_type, 'read');
     if (is_wp_error($order_id)) {
         return $order_id;
     }
     $refund_items = wc_get_orders(array('type' => 'shop_order_refund', 'parent' => $order_id, 'limit' => -1, 'return' => 'ids'));
     $order_refunds = array();
     foreach ($refund_items as $refund_id) {
         $order_refunds[] = current($this->get_order_refund($order_id, $refund_id, $fields));
     }
     return array('order_refunds' => apply_filters('woocommerce_api_order_refunds_response', $order_refunds, $order_id, $fields, $refund_items, $this));
 }
开发者ID:nishitlangaliya,项目名称:woocommerce,代码行数:22,代码来源:class-wc-api-orders.php


示例2: get_refunds

 /**
  * Get order refunds.
  * @since 2.2
  * @return array of WC_Order_Refund objects
  */
 public function get_refunds()
 {
     if (empty($this->refunds) && !is_array($this->refunds)) {
         $this->refunds = wc_get_orders(array('type' => 'shop_order_refund', 'parent' => $this->id, 'limit' => -1));
     }
     return $this->refunds;
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:12,代码来源:class-wc-order.php


示例3: wc_update_new_customer_past_orders

/**
 * Get past orders (by email) and update them.
 *
 * @param  int $customer_id
 * @return int
 */
function wc_update_new_customer_past_orders($customer_id)
{
    $linked = 0;
    $complete = 0;
    $customer = get_user_by('id', absint($customer_id));
    $customer_orders = wc_get_orders(array('limit' => -1, 'customer' => array(array(0, $customer->user_email)), 'return' => 'ids'));
    if (!empty($customer_orders)) {
        foreach ($customer_orders as $order_id) {
            update_post_meta($order_id, '_customer_user', $customer->ID);
            do_action('woocommerce_update_new_customer_past_order', $order_id, $customer);
            if (get_post_status($order_id) === 'wc-completed') {
                $complete++;
            }
            $linked++;
        }
    }
    if ($complete) {
        update_user_meta($customer_id, 'paying_customer', 1);
        update_user_meta($customer_id, '_order_count', '');
        update_user_meta($customer_id, '_money_spent', '');
    }
    return $linked;
}
开发者ID:pelmered,项目名称:woocommerce,代码行数:29,代码来源:wc-user-functions.php


示例4: get_refunds

 /**
  * Get order refunds.
  * @since 2.2
  * @return array of WC_Order_Refund objects
  */
 public function get_refunds()
 {
     $this->refunds = wc_get_orders(array('type' => 'shop_order_refund', 'parent' => $this->get_id(), 'limit' => -1));
     return $this->refunds;
 }
开发者ID:pelmered,项目名称:woocommerce,代码行数:10,代码来源:class-wc-order.php


示例5: get_customer_orders

 /**
  * Get the orders for a customer
  *
  * @since 2.1
  * @param int $id the customer ID
  * @param string $fields fields to include in response
  * @return array
  */
 public function get_customer_orders($id, $fields = null)
 {
     global $wpdb;
     $id = $this->validate_request($id, 'customer', 'read');
     if (is_wp_error($id)) {
         return $id;
     }
     $order_ids = wc_get_orders(array('customer' => $id, 'limit' => -1, 'orderby' => 'date', 'order' => 'ASC', 'return' => 'ids'));
     if (empty($order_ids)) {
         return array('orders' => array());
     }
     $orders = array();
     foreach ($order_ids as $order_id) {
         $orders[] = current(WC()->api->WC_API_Orders->get_order($order_id, $fields));
     }
     return array('orders' => apply_filters('woocommerce_api_customer_orders_response', $orders, $id, $fields, $order_ids, $this->server));
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:25,代码来源:class-wc-api-customers.php


示例6: woocommerce_account_orders

 /**
  * My Account > Orders template.
  *
  * @param int $current_page Current page number.
  */
 function woocommerce_account_orders($current_page)
 {
     $current_page = empty($current_page) ? 1 : absint($current_page);
     $customer_orders = wc_get_orders(apply_filters('woocommerce_my_account_my_orders_query', array('customer' => get_current_user_id(), 'page' => $current_page, 'paginate' => true)));
     wc_get_template('myaccount/orders.php', array('current_page' => absint($current_page), 'customer_orders' => $customer_orders, 'has_orders' => 0 < $customer_orders->total));
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:11,代码来源:wc-template-functions.php


示例7: column_default

    /**
     * Get column value.
     *
     * @param WP_User $user
     * @param string $column_name
     * @return string
     */
    public function column_default($user, $column_name)
    {
        global $wpdb;
        switch ($column_name) {
            case 'customer_name':
                if ($user->last_name && $user->first_name) {
                    return $user->last_name . ', ' . $user->first_name;
                } else {
                    return '-';
                }
            case 'username':
                return $user->user_login;
            case 'location':
                $state_code = get_user_meta($user->ID, 'billing_state', true);
                $country_code = get_user_meta($user->ID, 'billing_country', true);
                $state = isset(WC()->countries->states[$country_code][$state_code]) ? WC()->countries->states[$country_code][$state_code] : $state_code;
                $country = isset(WC()->countries->countries[$country_code]) ? WC()->countries->countries[$country_code] : $country_code;
                $value = '';
                if ($state) {
                    $value .= $state . ', ';
                }
                $value .= $country;
                if ($value) {
                    return $value;
                } else {
                    return '-';
                }
            case 'email':
                return '<a href="mailto:' . $user->user_email . '">' . $user->user_email . '</a>';
            case 'spent':
                return wc_price(wc_get_customer_total_spent($user->ID));
            case 'orders':
                return wc_get_customer_order_count($user->ID);
            case 'last_order':
                $orders = wc_get_orders(array('limit' => 1, 'status' => array('wc-completed', 'wc-processing'), 'customer' => $user->ID));
                if (!empty($orders)) {
                    $order = $orders[0];
                    return '<a href="' . admin_url('post.php?post=' . $order->id . '&action=edit') . '">' . _x('#', 'hash before order number', 'woocommerce') . $order->get_order_number() . '</a> &ndash; ' . date_i18n(get_option('date_format'), strtotime($order->order_date));
                } else {
                    return '-';
                }
                break;
            case 'user_actions':
                ob_start();
                ?>
<p>
					<?php 
                do_action('woocommerce_admin_user_actions_start', $user);
                $actions = array();
                $actions['refresh'] = array('url' => wp_nonce_url(add_query_arg('refresh', $user->ID), 'refresh'), 'name' => __('Refresh stats', 'woocommerce'), 'action' => "refresh");
                $actions['edit'] = array('url' => admin_url('user-edit.php?user_id=' . $user->ID), 'name' => __('Edit', 'woocommerce'), 'action' => "edit");
                $actions['view'] = array('url' => admin_url('edit.php?post_type=shop_order&_customer_user=' . $user->ID), 'name' => __('View orders', 'woocommerce'), 'action' => "view");
                $orders = wc_get_orders(array('limit' => 1, 'status' => array('wc-completed', 'wc-processing'), 'customer' => array(array(0, $user->user_email))));
                if ($orders) {
                    $actions['link'] = array('url' => wp_nonce_url(add_query_arg('link_orders', $user->ID), 'link_orders'), 'name' => __('Link previous orders', 'woocommerce'), 'action' => "link");
                }
                $actions = apply_filters('woocommerce_admin_user_actions', $actions, $user);
                foreach ($actions as $action) {
                    printf('<a class="button tips %s" href="%s" data-tip="%s">%s</a>', esc_attr($action['action']), esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name']));
                }
                do_action('woocommerce_admin_user_actions_end', $user);
                ?>
				</p><?php 
                $user_actions = ob_get_contents();
                ob_end_clean();
                return $user_actions;
        }
        return '';
    }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:76,代码来源:class-wc-report-customer-list.php



注:本文中的wc_get_orders函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wc_get_page_id函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_get_order_types函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap