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

Fix(OrderMerger): Do not carry line item adjustments to new order #4290

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Mar 3, 2022

Description

Adjustments are connected to the spree_orders table via two ways:

  • via their adjustable's (line item's) order ID
  • via their own order ID

If we move a line item with adjustments to new order, the adjustment's
order ID will not be changed to the new order.

Instead of changing the foreign key of an existing line item here, let's
build a new line item with the old line item's attributes.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change (if needed)

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice find.

core/spec/models/spree/order_merger_spec.rb Outdated Show resolved Hide resolved
Adjustments are connected to the spree_orders table via two ways:
- via their adjustable's (line item's) order ID
- via their own order ID

If we move a line item with adjustments to new order, the adjustment's
order ID will not be changed to the new order.

Instead of changing the foreign key of an existing line item here, let's
build a new line item with the old line item's attributes.
@mamhoff mamhoff force-pushed the fix-merged-order-adjustments branch from bfdbaef to afc2ded Compare March 3, 2022 11:53
Copy link
Member

@jarednorman jarednorman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mamhoff!

@kennyadsl kennyadsl merged commit 6ab74dd into solidusio:master Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants