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.2.11]: Inconsistent data between getLineItemById and getAllLineItemsByOrderId #3253

Closed
Nellyaa opened this issue Aug 15, 2023 · 4 comments
Assignees
Labels
bug commerce4 Issues related to Commerce v4

Comments

@Nellyaa
Copy link

Nellyaa commented Aug 15, 2023

What happened?

Description

When you use the functions getLineItemById and getAllLineItemsByOrderId you get inconsistent snapshot data.
One is already json decoded, while the other returns the json as a string.
In craft\commerce\services\LineItems

Steps to reproduce

  1. Get a lineItem by using getLineItemById and look at the snapshot data
  2. Get a lineItem by using getAllLineItemsByOrderId and look at the snapshot data

Expected behavior

Both functions return the snapshot in the same manner

Actual behavior

getLineItemById returns the data as string
getAllLineItemsByOrderId returns the data as array

Craft CMS version

Craft Pro 4.3.7.1

Craft Commerce version

4.2.11

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

@Nellyaa Nellyaa added commerce4 Issues related to Commerce v4 bug labels Aug 15, 2023
@jonleverrier
Copy link

@Nellyaa This might be a short term solution #1684 (comment)

@Nellyaa
Copy link
Author

Nellyaa commented Aug 24, 2023

@Nellyaa This might be a short term solution #1684 (comment)

Thank you, this is what we're currently doing!
I still think it should be changed in a future major version to be consistent though.

@nfourtythree
Copy link
Contributor

Hi all

Thank you for reporting. We have pushed up a fix which makes the return from these two methods consistent.

This fix will be included in the next release of Commerce.

To get this early, change your craftcms/commerce requirement in your project's composer.json to:

"require": {
  "craftcms/commerce": "dev-develop#2d0a70ba634b1184eb7b0e0ca40e209e3485196c as 4.3.1",
  "...": "..."
}

Then run composer update.

Thanks!

@lukeholder
Copy link
Member

This is now fixed in 4.3.2

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

4 participants