'WooCommerce "Error processing checkout. Please try again". How do I get more details?

I am writing (actually modifying an existing one) gift card plugin. During checkout, the gift cards are created on a different system through a Web JSON API.

The problem is, once I activate the modified plugin, I get "Error processing checkout. Please try again" when I click "Proceed to Payment". Obviously this has nothing to do with the payment gateway. In fact I am using coupons to make the total amount 0, so there's no payment involved.

So the question is, how can I get a more descriptive error message, so that I can track down the code causing an error?



Solution 1:[1]

The problem was that my code was echoing an error message and then exiting (exit(1)), which would then get forwarded to the front-end, which was expecting a JSON response (AJAX), hene the error message. In other words, that was a front-end error message.

To find out, I monitored the API call using Chrome DevTools.

Solution 2:[2]

Have you checked the fatal error logs? WooCommerce does try to capture fatals so ou might check WooCommerce -> Status -> Logs and see if any beginning with the word fatal appear in the dropdown. If so select it and view.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lfk
Solution 2 Jefferson Maes