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]: hasMatchingAddress returns false positive if fullName differs #2917

Closed
rynpsc opened this issue Jul 28, 2022 · 1 comment
Closed

[4.x]: hasMatchingAddress returns false positive if fullName differs #2917

rynpsc opened this issue Jul 28, 2022 · 1 comment
Assignees
Labels
bug commerce4 Issues related to Commerce v4

Comments

@rynpsc
Copy link
Contributor

rynpsc commented Jul 28, 2022

What happened?

Description

When an Order has two address with matching address expect for the fullName, hasMatchingAddress returns true.

It looks like when getting the Address attributes for comparison it is looking for givenName and familyName however when calling toArray on the Address element it's returning the name parts as firstName and lastName.

Steps to reproduce

  1. Create two address with the same fields except for the full name and use hasMatchingAddress

Expected behavior

hasMatchingAddress returns false when all but the full name matches.

Actual behavior

hasMatchingAddress returns true when all but the full name matches.

Craft CMS version

Craft Pro 4.1.4.1

Craft Commerce version

4.1.0

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

@rynpsc rynpsc added commerce4 Issues related to Commerce v4 bug labels Jul 28, 2022
@nfourtythree
Copy link
Contributor

Hi @rynpsc

Thank you for bringing this to our attention. We have pushed a fix for this which will be included in the next release of Commerce.

We are also looking to add to this feature in the upcoming 4.2 release that will allow developers to specify by which attributes addresses are determined as "matching". So for example you could decide that addresses do match if everything is the same but the names are different.

Thanks!

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
Projects
None yet
Development

No branches or pull requests

2 participants