تابع ووکامرسی wc_get_orders دریافت تمامی سفارشات فروشگاه

تابع ووکامرسی wc_get_orders – دریافت تمامی سفارشات فروشگاه
Syntax – سینتکس
(array|stdClass) wc_get_orders( (array) $args );
Parameters – پارامتر ها (1)
- 1- $args (array)
Returns – مقادیر بازگشتی (array|stdClass)
Number of pages and an array of order objects if paginate is true, or just an array of values.
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_orders' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-order-functions.php';
}
// Array of args (above)
$args = array();
// NOTICE! Understand what this does before running.
$result = wc_get_orders($args);
Defined – محل تعریف
/includes/wc-order-functions.php
function wc_get_orders( $args ) {
$args = wp_parse_args( $args, array(
'status' => array_keys( wc_get_order_statuses() ),
'type' => wc_get_order_types( 'view-orders' ),
'parent' => null,
'customer' => null,
'email' => '',
'limit' => get_option( 'posts_per_page' ),
'offset' => null,
'page' => 1,
'exclude' => array(),
'orderby' => 'date',
'order' => 'DESC',
'return' => 'objects',
'paginate' => false,
'date_before' => '',
'date_after' => '',
) );
// Handle some BW compatibility arg names wherewp_queryargs differ in naming.
$map_legacy = array(
'numberposts' => 'limit',
'post_type' => 'type',
'post_status' => 'status',
'post_parent' => 'parent',
'author' => 'customer',
'posts_per_page' => 'limit',
'paged' => 'page',
);
foreach ( $map_legacy as $from => $to ) {
if ( isset( $args[ $from ] ) ) {
$args[ $to ] = $args[ $from ];
}
}
return WC_Data_Store::load( 'order' )->get_orders( $args );
}
versions – نسخه ها
از نسخه : 2.6.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر