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

[4.x]: First name with hyphen is merged into last name after save #3480

Open
philipboomy opened this issue May 6, 2024 · 4 comments
Open
Assignees
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce

Comments

@philipboomy
Copy link

philipboomy commented May 6, 2024

What happened?

Description

When submitting separate first name and last name on the checkout then when the first name contains a hyphen "-" then after save the first name is blank the last name field contains the first name and last name.

Steps to reproduce

  1. submit first name and last name separately
  2. Make sure first name contains a hyphen "-" .e.g. "Chi-la".
  3. Last name can be anything e.g. "Smith"
  4. Submit the form.
  5. Refresh and now the first name field is empty and the last name contains "Chi-la Smith"

Expected behavior

I would expect first name field contains "Chi-la" and last name contains "Smith.

WARNING! Stripe does not not support hyphen "-" in the name so perhaps better to output this:

First name: "Chi la"
Last name: "Smith

Alternatively strip the hyphen "-" from the stripe payment request generation.

I noticed this issue as a customer couldn't pay due to Stripe having a JS error.
Uncaught (in promise) TypeError: paymentResponse.redirectData is undefined
due to no first name stored on the order.

Actual behavior

First name: (blank)
Last name: "Chi-la Smith"

Craft CMS version

4.8.10

Craft Commerce version

4.5.4

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@philipboomy philipboomy added bug commerce4 Issues related to Commerce v4 Craft Commerce labels May 6, 2024
Copy link

linear bot commented May 6, 2024

@lukeholder
Copy link
Member

@philipboomy

I cant reproduce on latest Craft Commerce 4.x release. Can you confirm if it is happening on address save, or is it only happening when supplied to Stripe?

@philipboomy
Copy link
Author

@lukeholder Thanks for quick reply.

It happens on address save but part of the guest checkout so using commerce/cart/update-cart, I just noticed because Stripe complained. I have shared a link to production site in Discord.

@lukeholder lukeholder self-assigned this May 6, 2024
@lukeholder
Copy link
Member

ffr, after discussion on discord, this is only happening on his production site with 'chi-la', but not other hyphenated names. 'chi-la' works on my local dev machine. Going to need to look into it more using the same production templates/project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce
Projects
None yet
Development

No branches or pull requests

2 participants