• Resolved nomangardazi

    (@nomangardazi)


    Dear WT Smart Coupons Support Team,

    I’m experiencing a fatal error when trying to cancel WooCommerce orders that have 100% discount coupons applied. Here are the specific details:Problem Description

    When I try to cancel an order from the individual order edit page, I get a fatal error. However, the cancellation works perfectly when using bulk operations on the orders overview page.

    Error Message:
    PHP Fatal error: Uncaught Error: Call to a member function get_cart() on null in /wp-content/plugins/wt-smart-coupons-for-woocommerce/public/modules/exclude-product/exclude-product.php:161

    Key Observations

    • The error only occurs on the order edit page, not during bulk operations
    • The issue specifically involves orders with 0 totals.
    • The plugin tries to access WC()->cart->get_cart() during validation, but WC()->cart is null in admin context

      I look forward to your response and any guidance you can provide.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @nomangardazi,

    Thank you for sharing the detailed report and error logs.

    From what you described, the fatal error occurs because the plugin is trying to access WC()->cart->get_cart() during validation, but in the admin order edit context (when cancelling from the single order page), the cart object is not available. That explains why the error doesn’t happen during bulk operations.

    To help us confirm the scenario fully, could you please share:

    1. A copy of your site’s System Status Report (WooCommerce > Status > Get system report).
    2. If you see any error messages directly on the order edit page while cancelling, please also share a screenshot of that.

    You can securely upload these details via this link.

    Thread Starter nomangardazi

    (@nomangardazi)

    Hello

    Thanks for your reply.
    I tried submitting ticket via https://www.webtoffee.com/contact/ but the from on the website is not working.
    I do not see any other errors I mentioned in my first message.
    Below is the link to system status report.

    https://pastebin.com/3hzEruYz

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @nomangardazi,

    Thanks again for your update.

    It’s possible that a caching issue is affecting the form submission. Could you please try the following:

    • Clear your browser cache and cookies, or
    • Try submitting the form using a different browser or in incognito/private mode?

    If it’s working, please also include the following when you reach out:

    • A screenshot of the coupon settings used for the affected order.
    • Whether the products there are excluded from coupons (check individual product edit pages).
    • Was the order created from the frontend or backend?
    • Does the issue happen with only Smart Coupons and WooCommerce active?

    We’ll be happy to take a closer look once we have those details.

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @nomangardazi,

    As we did not receive any response or follow-up questions from you, we will assume you got this working to your requirements. If you still have any more questions for us, please open a new thread, because we will mark this one as resolved.

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

The topic ‘Fatal Error When Cancelling Orders’ is closed to new replies.