When "Debug Mode" is enabled in the WooCommerce Square extension and set to "Show on Checkout Page" or "Both," the detailed error messages fail to appear on the checkout page as expected, showing only the generic user-facing error message. The expected behavior for me is either the detailed message replacing the generic one or both messages being displayed together.
Steps to reproduce
Activate the Square extension.
Navigate to WooCommerce > Settings.
Go to the Square tab.
Access the Advanced Settings section.
Set the Debug Mode field to Show on Checkout Page or Both.
Configure the environment to force an error condition (e.g., missing 3D Secure Verification Token).
Add a product to the cart and proceed to the checkout page.
Expected behavior
The detailed error message should be displayed on the checkout page (e.g., "3D Secure Verification Token is missing", or any other you forced to happen).
Current behavior
The checkout page only displays a generic user-facing error message instead of the expected detailed error message, even when debug mode is enabled.
Initial investigation
I noticed that this piece of code is properly adding two notices when an issue occurs during checkout:
A generic user-facing error message.
A detailed error message.
I also notice that WooCommerce's wc_add_notice function is correctly adding both notices to the session.
However, only the first (user-facing) message is displayed on the Checkout Page.
Just for reference, until we have this fixed, to make the detailed checkout payment gateway error messages to appear on my local environment and fulfill my debugging needs during development, I changed this to the lines below, and it's working as needed.
if ( 'off' == $this->debug_off() ) {
Square_Helper::wc_add_notice( __( 'An error occurred, please try again or try an alternate form of payment.', 'woocommerce-square' ), 'error' );
} else {
Square_Helper::wc_add_notice( $exception->getMessage(), 'error' );
$this->add_debug_message( $exception->getMessage(), 'error' );
}
When "Debug Mode" is enabled in the WooCommerce Square extension and set to "Show on Checkout Page" or "Both," the detailed error messages fail to appear on the checkout page as expected, showing only the generic user-facing error message. The expected behavior for me is either the detailed message replacing the generic one or both messages being displayed together.
Steps to reproduce
Expected behavior
The detailed error message should be displayed on the checkout page (e.g., "3D Secure Verification Token is missing", or any other you forced to happen).
Current behavior
The checkout page only displays a generic user-facing error message instead of the expected detailed error message, even when debug mode is enabled.
Initial investigation
I noticed that this piece of code is properly adding two notices when an issue occurs during checkout:
I also notice that WooCommerce's
wc_add_notice
function is correctly adding both notices to the session.However, only the first (user-facing) message is displayed on the Checkout Page.
Just for reference, until we have this fixed, to make the detailed checkout payment gateway error messages to appear on my local environment and fulfill my debugging needs during development, I changed this to the lines below, and it's working as needed.