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(carts): Fixes cart modifications not accounting for certain price lists #10493

Conversation

sergiocampama
Copy link
Contributor

@sergiocampama sergiocampama commented Dec 8, 2024

What

Why

  • Cart updates from the storefront were overriding any valid price lists
    that were correctly being shown in the storefront's product pages.

How

  • Adds a new workflow step that expands an optional customer_id into the
    customer_group_ids it belongs to.
  • Uses this step in the addToCartWorkflow and
    updateLineItemInCartWorkflow workflows.
  • Following a similar approach as in set-pricing-context.ts used for the
    store/products routes, but that middleware was too specific for carts.

Testing

  • Using medusa-dev to test on a local backend.
  • Adds integration tests for the addToCart and updateLineItemInCart
    workflows.

Copy link

changeset-bot bot commented Dec 8, 2024

⚠️ No Changeset found

Latest commit: c3f5418

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 8, 2024

@sergiocampama is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Dec 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-ui ❌ Failed (Inspect) Dec 12, 2024 11:27am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 11:27am

@sergiocampama sergiocampama force-pushed the fix/price_list_cart_updates branch 2 times, most recently from 9c8e442 to fb18b2b Compare December 8, 2024 04:11
@sergiocampama sergiocampama force-pushed the fix/price_list_cart_updates branch 3 times, most recently from 7b970b4 to 36bba9c Compare December 8, 2024 04:15
@sergiocampama sergiocampama marked this pull request as ready for review December 8, 2024 04:15
@sergiocampama sergiocampama requested a review from a team as a code owner December 8, 2024 04:15
@sergiocampama sergiocampama force-pushed the fix/price_list_cart_updates branch from 36bba9c to a2b12aa Compare December 10, 2024 03:07
@sergiocampama
Copy link
Contributor Author

Updated to account for latest changes

… lists

*What*

* Fixes medusajs#10490
* Expands any available customer_id into its customer_group_ids for cart
  updates that add line items.

*Why*

* Cart updates from the storefront were overriding any valid price lists
  that were correctly being shown in the storefront's product pages.

*How*

* Adds a new workflow step that expands an optional customer_id into the
  customer_group_ids it belongs to.
* Uses this step in the addToCartWorkflow and
  updateLineItemInCartWorkflow workflows.

*Testing*
* Using medusa-dev to test on a local backend.
* Adds integration tests for the addToCart and updateLineItemInCart
  workflows.
@sergiocampama sergiocampama force-pushed the fix/price_list_cart_updates branch from a2b12aa to 10a53cc Compare December 10, 2024 12:29
@sergiocampama
Copy link
Contributor Author

@olivermrbl is this change not wanted? or anyone else looking to do it differently? this is blocking my adoption of medusa

@riqwan
Copy link
Contributor

riqwan commented Dec 11, 2024

Hey @sergiocampama, thanks for the PR. This is needed, we're approaching it slightly differently. Expect a PR on this early next week. I'll merge this into my branch, so your contribution is accounted. 🤞🏻

@sergiocampama
Copy link
Contributor Author

thanks @riqwan , let me know when your PR is available, it took some time understanding the architecture to be able to create this PR, so it'd be good to understand the new direction in case I need to contribute more in the future

@riqwan riqwan changed the base branch from develop to feat/customer-group December 12, 2024 11:24
@riqwan riqwan requested review from a team as code owners December 12, 2024 11:24
@riqwan riqwan changed the base branch from feat/customer-group to develop December 12, 2024 11:25
@riqwan riqwan changed the base branch from develop to feat/customer-group-context December 12, 2024 11:26
@riqwan riqwan merged commit ef7a6ea into medusajs:feat/customer-group-context Dec 12, 2024
3 of 10 checks passed
riqwan added a commit that referenced this pull request Dec 17, 2024
* fix(carts): Fixes cart modifications not accounting for certain price lists (#10493)

*What*

* Fixes #10490
* Expands any available customer_id into its customer_group_ids for cart
  updates that add line items.

*Why*

* Cart updates from the storefront were overriding any valid price lists
  that were correctly being shown in the storefront's product pages.

*How*

* Adds a new workflow step that expands an optional customer_id into the
  customer_group_ids it belongs to.
* Uses this step in the addToCartWorkflow and
  updateLineItemInCartWorkflow workflows.

*Testing*
* Using medusa-dev to test on a local backend.
* Adds integration tests for the addToCart and updateLineItemInCart
  workflows.

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>

* chore: update cart workflows to accept new pricing context

* chore: add transfer specs

* chore: fix specs

* chore: modify types + specs

* chore: add data migration + dashboard changes

* chore: fix update line item workflow

* chore: add changeset + unskip spec

---------

Co-authored-by: Sergio Campamá <sergiocampama@gmail.com>
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.

[Bug]: Prices from price lists are not applicable when adding to cart.
2 participants