• Jonathan

    (@johnccg)


    Hello,

    I am experiencing an issue with the Gift4U plugin when a gift card is used to fully cover or exceed the total amount of the cart in WooCommerce. Here are the details of the issue:

    1. Context:
      • The gift card value is €80.
      • The cart total is €77.80.
      • After applying the gift card, the final order total becomes €0.
    2. Issue:
      • When the user attempts to place the order, a critical error occurs. WooCommerce logs indicate that the function get_tentative_usages_for_user() is being called on a null object.
      • Here’s an excerpt from the log:vbnetCopier le codeUncaught Error: Call to a member function get_tentative_usages_for_user() on null in /wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:521
    3. Observations:
      • The issue appears to be related to the handling of orders where the final total is €0, which might conflict with the coupon validation or the order processing logic.
    4. Tests Performed:
      • Orders with a total greater than €0 process correctly.

    Expected Outcome: Could you please let me know if there’s an update or fix to resolve this issue? Alternatively, do you have recommendations on configuring the gift cards in such scenarios?

    Feel free to reach out if you need additional details or if I can assist with further testing.

Viewing 7 replies - 1 through 7 (of 7 total)
  • alitschi

    (@alitschi)

    I experience today the very similar problem. In our setup, we encounter the following two-step problems:

    1. If the customer redeems a gift card voucher (less than order value AND greater than order value), the cart always leaves the shipping charges untouched. Therefore a customer with sufficient gift card value will still have to pay shipping charges separately.
    2. But even when trying to pay with the gift card credit, it does not successfully finish the order. When the user attempts to place the order, a critical error occurs.

    This leaves another issue open – namely how the customer will see any possible remaining balance in his account overview. We cannot verify such next step. We would highly appreciate an update or fix to resolve this issues.

    alitschi

    (@alitschi)

    We quickly checked the log files regarding our above-mentioned issue. Please find below the details of the error message stored in WP log files:

    2024-12-30T10:13:24+00:00 Kritisch Uncaught Error: Call to a member function get_tentative_usages_for_user() on null in /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:521

    Plugin Support angelagrey

    (@angelagrey)

    Hi guys,

    Thank you for reaching out to us.

    It could be possible that a theme or plugin conflict is causing this behavior. In this case, we would recommend testing by taking the following steps:?https://docs.woocommerce.com/document/woocommerce-self-service-guide/

    If you don’t want to perform these tests on the live site, I would recommend reaching out to your web host to see if they offer a staging site as part of your hosting package. If not, then I’d recommend using the WP Staging plugin to duplicate the site.

    Let us know how this goes!

    Best regards.

    alitschi

    (@alitschi)

    We now tested your plugin GIFT4U by switching to the very basic WP theme “Twenty-twenty four” and disabled all other plugins. But we are still encountering the same problems. It seems that GIFT4U does not integrate all the way with the woocommerce coupon functions and for those reasons it crashes when taking the final step of payment. Ideally, the GIFT4U coupons are also shown in the regular list of woocommerce coupons which guarantees compatibility. Is there a fix for these problems of GIFT4U?

    Best regards,

    Plugin Support angelagrey

    (@angelagrey)

    Thank you for your detailed feedback. We conducted tests on our own site using the GIFT4U plugin, but we did not encounter the issues you described: https://snipboard.io/0OizjC.jpg

    Regarding your points, our plugin operates independently and doesn’t inherently integrate with the WooCommerce coupon list, that’s why its gift cards don’t appear in the regular WooCommerce coupon section. Its gift card coupon feature is built on WooCommerce’s standard coupon feature though.

    If the issue persists on your site even with only WooCommerce and GIFT4U active, and it’s gone once you disable our plugin, please open a ticket on this Support Forum and allow us to take some direct tests, we’ll check it.

    alitschi

    (@alitschi)

    Thank you for the response.

    We reached out to the Theme provider (Envato) to get their testing and feedback. Their answer was as follows:

    “The theme is basically a skin and it doesn’t change the processes in checkout and it doesn’t perform any validations for coupons or payment options. That’s from the WooCommerce code or 3rd party plugins. Nothing in the error logs indicate a problem with the theme.”

    We disabled all plugins with the exception of woocommerce, woopayment and woocommerce multilingual as otherwise the site would not work for testing real redemption of a gift card coupon. We are still experiencing a fatal error with the following log entry:

    2025-01-03T20:22:34+00:00Kritisch Uncaught Error: Call to a member function get_tentative_usages_for_user() on null in /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:521 Zus?tzlicher Kontext{ “error”: { “type”: 1, “file”: “/home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php”, “line”: 521 }, “remote-logging”: true, “backtrace”: [ “”, “#0 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php(451): Automattic\WooCommerce\StoreApi\Utilities\OrderController->get_usage_per_aliases(Object(WC_Coupon), Array)”, “#1 [internal function]: Automattic\WooCommerce\StoreApi\Utilities\OrderController->validate_coupon_usage_limit(Object(WC_Coupon), Object(Automattic\WooCommerce\Admin\Overrides\Order))”, “#2 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php(203): call_user_func_array(Array, Array)”, “#3 [internal function]: Automattic\WooCommerce\StoreApi\Utilities\OrderController->Automattic\WooCommerce\StoreApi\Utilities\{closure}(‘validate_coupon…’, 1, Array)”, “#4 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php(205): array_walk(Array, Object(Closure), Array)”, “#5 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php(170): Automattic\WooCommerce\StoreApi\Utilities\OrderController->validate_coupons(Object(Automattic\WooCommerce\Admin\Overrides\Order))”, “#6 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php(284): Automattic\WooCommerce\StoreApi\Utilities\OrderController->validate_order_before_payment(Object(Automattic\WooCommerce\Admin\Overrides\Order))”, “#7 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractRoute.php(119): Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->get_route_post_response(Object(WP_REST_Request))”, “#8 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php(136): Automattic\WooCommerce\StoreApi\Routes\V1\AbstractRoute->get_response_by_request_method(Object(WP_REST_Request))”, “#9 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1292): Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->get_response(Object(WP_REST_Request))”, “#10 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request(Object(WP_REST_Request), ‘/wc/store/v1/ch…’, Array, NULL)”, “#11 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))”, “#12 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/rest-api.php(449): WP_REST_Server->serve_request(‘/wc/store/v1/ch…’)”, “#13 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP))”, “#14 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)”, “#15 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/plugin.php(565): WP_Hook->do_action(Array)”, “#16 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/class-wp.php(418): do_action_ref_array(‘parse_request’, Array)”, “#17 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/class-wp.php(813): WP->parse_request(”)”, “#18 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-includes/functions.php(1336): WP->main(”)”, “#19 /home/httpd/vhosts/xxxxxx.ch/httpdocs/wp-blog-header.php(16): wp()”, “#20 /home/httpd/vhosts/xxxxxx.ch/httpdocs/index.php(17): require(‘/home/httpd/vho…’)”, “#21 {main}”, “thrown” ] }

    On top, we are also unable to process a checkout where the cart balance is “0” after applying a gift card coupon. For some reason, the GIFT4U coupons are creating an fatal error in the payment process … and yet the system recognises GIFT4U coupons all the way in the checkout process … until “pay now” ist clicked -> fatal error.

    Many thanks for looking again into this issue.

    Plugin Support angelagrey

    (@angelagrey)

    Hi,

    Thank you for the details. Upon reviewing the error report, there’s none related to our plugin or pointed at our plugin directly. Could you please switch theme, or try with a WooCommerce coupon which makes order total 0 to test?

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