• Resolved Leo.Lin

    (@bi1012037)


    I tried using this API:?wcapi.get("reports/sales?period=month").json(). It worked fine before the upgrade, but after upgrading to version 1.5.7, the values returned are all 0.

    I have inquired with WooCommerce plugin support and confirmed that the issue is caused by the upgrade of the Woo-wallet plugin.

    The detailed tracking URL is: https://www.ads-software.com/support/topic/is-there-an-issue-with-the-retrieve-sales-report-api/#post-17990908

    Result:
    [{‘total_sales’: ‘0.00’, ‘net_sales’: ‘0.00’, ‘average_sales’: ‘0.00’, ‘total_orders’: 0, ‘total_items’: 0, ‘total_tax’: ‘0.00’, ‘total_shipping’: ‘0.00’, ‘total_refunds’: 0, ‘total_discount’: ‘0.00’, ‘totals_grouped_by’: ‘day’, ‘totals’: {‘2024-09-01’: {‘sales’: ‘0.00’, ‘orders’: 0, ‘items’: 0, ‘tax’: ‘0.00’, ‘shipping’: ‘0.00’, ‘discount’: ‘0.00’, ‘customers’: 2}, ‘2024-09-02’: {‘sales’: ‘0.00’, ‘orders’: 0, ‘items’: 0, ‘tax’: ‘0.00’, ‘shipping’: ‘0.00’, ‘discount’: ‘0.00’, ‘customers’: 6}, ‘2024-09-03’: {‘sales’: ‘0.00’, ‘orders’: 0, ‘items’: 0, ‘tax’: ‘0.00’, ‘shipping’: ‘0.00’, ‘discount’: ‘0.00’, ‘customers’: 0}}, ‘total_customers’: 8, ‘_links’: {‘about’: [{‘href’: ‘https://$mydomain/wp-json/wc/v3/reports’}]}}]

    error log

    [error] 294169#0: *1827 FastCGI sent in stderr: "PHP message: WC_Order_Data_Store_CPT::query was called incorrectly. 目前的訂單資料存放區不支援訂單查詢引數 (meta_query)。 Backtrace: require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, WC_REST_Report_Sales_V1_Controller->get_items, WC_REST_Report_Sales_V1_Controller->prepare_item_for_response, WC_Report_Sales_By_Date->get_report_data, WC_Report_Sales_By_Date->query_report_data, WC_Admin_Report->get_order_report_data, apply_filters('woocommerce_reports_get_order_report_query'), WP_Hook->apply_filters, WooWallet->woocommerce_reports_get_order_report_query, get_wallet_rechargeable_orders, wc_get_orders, WC_Order_Query->get_orders, WC_Data_Store->__call, WC_Order_Data_Store_CPT->query, wc_doing_it_wrong. This message was added in version 9.2.0.PHP message: WC_Order_Data_Store_CPT::query was called incorrectly. 目前的訂單資料存放區不支援訂單查詢引數 (meta_query)。 Backtrace: require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, WC_REST_Report_Sales_V1_Controller->get_items, WC_REST_Report_Sales_V1_Controller->prepare_item_for_response, WC_Report_Sales_By_Date->get_report_data, WC_Report_Sales_By_Date->query_report_data, WC_Admin_Report->get_order_report_data, apply_filters('woocommerce_reports_get_order_report_query'), WP_Hook->apply_filters, WooWallet->woocommerce_reports_get_order_report_query, get_wallet_rechargeable_orders, wc_get_orders, WC_Order_Query->get_orders, WC_Data_Store->__call, WC_Order_Data_Store_CPT->query, wc_doing_it_wrong. This message was added in version 9.2.0.PHP message: WC_Order_Data_Sto

    [error] 294169#0: *1827 FastCGI sent in stderr: "pond_to_request, WC_REST_Report_Sales_V1_Controller->get_items, WC_REST_Report_Sales_V1_Controller->prepare_item_for_response, WC_Report_Sales_By_Date->get_report_data, WC_Report_Sales_By_Date->query_report_data, WC_Admin_Report->get_order_report_data, apply_filters('woocommerce_reports_get_order_report_query'), WP_Hook->apply_filters, WooWallet->woocommerce_reports_get_order_report_query, get_wallet_rechargeable_orders, wc_get_orders, WC_Order_Query->get_orders, WC_Data_Store->__call, WC_Order_Data_Store_CPT->query, wc_doing_it_wrong. This message was added in version 9.2.0.PHP message: WC_Order_Data_Store_CPT::query was called incorrectly. 目前的訂單資料存放區不支援訂單查詢引數 (meta_query)。 Backtrace: require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, WC_REST_Report_Sales_V1_Controller->get_items, WC_REST_Report_Sales_V1_Controller->prepare_item_for_response, WC_Report_Sales_By_Date->get_report_data, WC_Report_Sales_By_Date->query_report_data, WC_Admin_Report->get_order_report_data, apply_filters('woocommerce_reports_get_order_report_query'), WP_Hook->apply_filters, WooWallet->woocommerce_reports_get_order_report_query, get_wallet_rechargeable_orders, wc_get_orders, WC_Order_Query->get_orders, WC_Data_Store->__call, WC_Order_Data_Store_CPT->query, wc_doing_it_wrong. This message was added in version 9.2.0.PHP message: WC_Order_Data_Store_CPT::query was called incorrectly. 目前的訂單資料存放區不支援訂單查詢引數 (meta_query)。 Backtrace: require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, WC_REST_Repor..
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Leo.Lin

    (@bi1012037)

    I found that the severe error was caused by changing the function in the file woo-wallet-util.php. I have already rolled it back for now!

    File PATH:woo-wallet/includes/helper/woo-wallet-util.php
    Code rollback portion

    if ( ! function_exists( 'get_wallet_rechargeable_orders' ) ) {

    /**
    * Return wallet rechargeable order id.
    *
    * @param array $args args.
    * @return array
    */
    function get_wallet_rechargeable_orders( $args = array() ) {
    $default_args = array(
    'posts_per_page' => -1,
    'meta_key' => '_wc_wallet_purchase_credited', // @codingStandardsIgnoreLine
    'meta_value' => true, // @codingStandardsIgnoreLine
    'post_type' => 'shop_order',
    'post_status' => array( 'completed', 'processing', 'on-hold' ),
    'suppress_filters' => true,
    );
    $args = wp_parse_args( $args, $default_args );
    $orders = get_posts( $args );
    return wp_list_pluck( $orders, 'ID' );
    /*$order_ids = wc_get_orders(
    array(
    'limit' => -1,
    'meta_query' => array(
    array(
    'key' => '_wc_wallet_purchase_credited',
    'value' => true,
    ),
    ),
    'return' => 'ids',
    )
    );
    return $order_ids;*/
    }
    }

    Plugin Author Subrata Mal

    (@subratamal)

    @bi1012037 Please let us know if you are using WooCommerce High-performance order storage.

    Thread Starter Leo.Lin

    (@bi1012037)

    @subratamal
    Hi, we have not changed any settings, nor are we using using WooCommerce High-performance order storage.

    Plugin Author Subrata Mal

    (@subratamal)

    @bi1012037 Thanks for sharing the screenshot. We will apply the backward compatibility with order in post table in our next plugin update. In the mean time you can use this code in theme functions.php file to fix the issue.

    add_filter('woo_wallet_exclude_wallet_rechargeable_orders_from_report', '__return_false');
    • This reply was modified 2 months, 2 weeks ago by Subrata Mal.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.