Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Checkout validation, detailed error messages aren't being displayed on Checkout Page #240

Open
MiguelAxcar opened this issue Nov 19, 2024 · 0 comments
Labels
priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc.

Comments

@MiguelAxcar
Copy link

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

  1. Activate the Square extension.
  2. Navigate to WooCommerce > Settings.
  3. Go to the Square tab.
  4. Access the Advanced Settings section.
  5. Set the Debug Mode field to Show on Checkout Page or Both.
    Image
  6. Configure the environment to force an error condition (e.g., missing 3D Secure Verification Token).
  7. 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.

Image


Initial investigation

  • I noticed that this piece of code is properly adding two notices when an issue occurs during checkout:

    1. A generic user-facing error message.
    2. 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' );
}
@vikrampm1 vikrampm1 added the priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc.
Projects
None yet
Development

No branches or pull requests

2 participants