bigcommerce / bigcommerce-for-wordpress

A headless commerce integration for WordPress, powered by BigCommerce
https://www.bigcommerce.com/wordpress/
GNU General Public License v2.0
109 stars 49 forks source link

Registration Form - No error message displayed #360

Closed rjmccollam closed 2 years ago

rjmccollam commented 2 years ago

Expected behavior

When a user fills out the account registration form output by the shortcode [bigcommerce_registration_form] in a way that does not allow validations to pass, descriptive errors should be displayed to educate the user on why the registration failed.

Actual behavior

On an unsuccessful registration user is redirected back to the register page with no errors being displayed outside of classes being added to fields with issues.

A specific validation issue is if a user enters a password that doesn't meet the minimum requirements. The user is presented with no context other than the password field being highlighted.

Steps to reproduce behavior

  1. Navigate to https://portacool.com/register
  2. Fill out all required fields. For the password field enter "1234".
  3. Click Register

Workaround or possible solution

Currently errors are available as an array of strings. If I was provided with a list of possible strings that could be present in the array with the reason as to why they were present I can adjust the plugin to output the errors to the user.

tyla-taylor commented 2 years ago

@rjmccollam we were not able to replicate the issue. However, on the site you provided above, our dev was able to replicate and see several issues in console. He didn't see the required error wrapper added below the field. Could you check your code/setup and fix any issues that may prevent execution of javascript? Thanks.

rjmccollam commented 2 years ago

Thanks @tyla-taylor. We are not knowingly doing anything that would prevent the execution of javascript. If we were I would imagine we would have lots of issues.

I did go in and correct the only console error we were seeing, but that did not correct the issue.

Is it fair to assume that if javascript was not being blocked from executing that functionality like the mini cart preview would also not work? Wanting to ensure if that is what we are thinking is the issue that we have something else to confirm is in fact broken to help support that theory.

tyla-taylor commented 2 years ago

@rjmccollam this seems to be environment specific.

First you should check the value returned from bigcommerce/forms/show_error_messages and bigcommerce/messages/success/arguments hooks. If it is not true then he won’t see any messages

Also check the if get parameters are allowed on the servers e.g when user submits the form in case of error url will be https://url.com/register?bc-error=bc62a9dcb0e7c145.18650970

If such urls are not allowed then message won’t work.

Regarding additional question: if there is some blocking request/issue in Javascript and it happens before plugin script loading then it may cause the issues and prevent plugin’s scrips work

rjmccollam commented 2 years ago

I have narrowed this down to something in our theme causing the issue. Nothing immediately jumps out as "this is the issue!", but will keep debugging.

Closing this issue.

rjmccollam commented 2 years ago

Figured out the issue so posting for possible future reference.

Our theme utilized the flexible content fields in Advanced Custom Fields for the building of the site with content blocks. We had been outputting the BC registration form via a shortcode in a WYSIWYG editor, but it looks like the plugin was looking for the loop and the_content() to properly handle errors.

Ensuring those were able to exist on the page corrected the issue.