• Resolved jojobabrian

    (@jojobabrian)


    I just upgrade WordPress and WooCommerce to the latest versions and my API calls are failing with a 500 error. Error log output below.

    Any help or guidance would be appriciated.

    Uncaught WC_Data_Exception: Invalid discount type in /code/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:943 Stack trace: #0 /code/wp-content/plugins/woocommerce/includes/class-wc-coupon.php(549): WC_Data->error(‘coupon_invalid_…’, ‘Invalid discoun…’) #1 /code/wp-content/plugins/woocommerce/includes/class-wc-coupon.php(1188): WC_Coupon->set_discount_type(‘adp_fixed_cart_…’) #2 /code/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php(297): WC_Coupon->set_short_info(Array) #3 [internal function]: WC_REST_Orders_V2_Controller->get_order_item_data(Object(WC_Order_Item_Coupon)) #4 /code/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php(475): array_map(Array, Array) #5 /code/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php(543): WC_REST_Orders_V2_Controller->get_formatted_item_data(Object(Automattic\WooCommerce\Admin\Overrides\Order)) #6 /code/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php(391): WC_REST_Orders_V2_Controller->prepare_object_for_response(Object(Automattic\WooCommerce\Admin\Overrides\Order), Object(WP_REST_Request)) #7 /code/wp-includes/rest-api/class-wp-rest-server.php(1230): WC_REST_CRUD_Controller->get_items(Object(WP_REST_Request)) #8 /code/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request(Object(WP_REST_Request), ‘/wc/v2/orders’, Array, NULL) #9 /code/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request)) #10 /code/wp-includes/rest-api.php(428): WP_REST_Server->serve_request(‘/wc/v2/orders’) #11 /code/wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP)) #12 /code/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #13 /code/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #14 /code/wp-includes/class-wp.php(418): do_action_ref_array(‘parse_request’, Array) #15 /code/wp-includes/class-wp.php(813): WP->parse_request(”) #16 /code/wp-includes/functions.php(1336): WP->main(”) #17 /code/wp-blog-header.php(16): wp() #18 /code/index.php(17): require(‘/code/wp-blog-h…’) #19 {main} thrown in /code/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php on line 943 CONTEXT: {“data”:null}

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there @jojobabrian,

    Thanks for reaching out.

    Looking at the shared error message, it appears that there’s an issue with a discount type in your WooCommerce coupon settings.

    Here’s what you can do to troubleshoot the issue further:

    1. If you’re using any plugins related to discounts or coupons, ensure they’re compatible with the latest versions of WordPress and WooCommerce.
    2. If the issue persists, try disabling all plugins except WooCommerce to see if there’s a plugin conflict. If the issue is resolved, enable the plugins one by one to identify the conflicting one.

    If the issue persists, please share with us your system status report, which you can find via WooCommerce > Status > Get system report > Copy for support.

    Looking forward to your reply.

    Thread Starter jojobabrian

    (@jojobabrian)

    This was an issue with a plugin that I was using. I contacted the developer and they have resolvedd the issue.

    Hello @jojobabrian,

    Glad to hear it – thanks for letting us know!

    I’ll mark this thread as resolved now. If you have any further questions, I recommend creating a new thread.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘500 Fatal Error when making API call’ is closed to new replies.