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 · 1 comment
Labels
priority: high The issue/PR is high priority—if affect lots of customers substantially, but not critically.

Comments

@MiguelAxcar
Copy link
Contributor

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
@kaushikasomaiya
Copy link

@vikrampm1 @iamdharmesh Can we pick this up please? Because say the user enters invalid phone number, the generic message won't encourage / give a chance to correct it - possible loss of sales I believe.

$this->mark_order_as_failed( $order, $e->getMessage() );

This doesn't pass a response but a message which is probably missed here

if ( $response && $this->is_detailed_customer_decline_messages_enabled() ) {

Also can we get some clarity between Debug Mode (save to log) vs Enable Logging:

Image

@vikrampm1 vikrampm1 added priority: high The issue/PR is high priority—if affect lots of customers substantially, but not critically. and removed priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. labels Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The issue/PR is high priority—if affect lots of customers substantially, but not critically.
Projects
None yet
Development

No branches or pull requests

3 participants