• 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 9.2.3, the values returned are all 0.

    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’}]}}]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Leo.Lin

    (@bi1012037)

    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...
    • This reply was modified 2 months, 2 weeks ago by Leo.Lin.
    • This reply was modified 2 months, 2 weeks ago by Leo.Lin.
    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @bi1012037

    Based on the error log you’ve shared, it seems like the problem is related to the WC_Order_Data_Store_CPT::query method being called incorrectly. Specifically, the current order data store doesn’t support the order query parameter (meta_query).

    This might be a result of changes in the latest version of WooCommerce (REST API V3). I would suggest you to check the usage of the WC_Order_Data_Store_CPT::query method in your code and ensure it’s being used correctly as per the latest WooCommerce documentation: https://woocommerce.github.io/woocommerce-rest-api-docs/#orders

    If you’re using a third-party plugin like WooWallet, I recommend contacting the plugin developers for further assistance, as the error seems to be originating from there.

    Please let us know if you have any other questions or if there’s anything else we can assist you with.

    Thread Starter Leo.Lin

    (@bi1012037)

    Okay, I will check the third-party plugins again. I’ll turn them off for now. Thank you for the tip!

    Plugin Support Rajesh K. (woo-hc)

    (@rajeshml)

    Hello @bi1012037,

    You’re welcome! I’m glad we could help.

    Should you have further inquiries, kindly create a new topic here.

    Meanwhile, if it isn’t too much to ask for – would you mind leaving us a review here? It only takes a couple of minutes but helps us tremendously. It would mean so much to us and would go a long way.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.