-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[Bug]: Prices from price lists are not applicable when adding to cart. #10490
Comments
I was looking into this today too. Was able to find that adding a product to a cart uses the Was trying to develop locally but it hasn't been super easy setting a reproducible development stack. |
sergiocampama
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… lists Price lists may sometimes be bound to certain customer groups. The addToCartWorkflow and updateLineItemInCartWorkflow workflows were indeed accounting for the pricing context based on the cart's region, customer id and currency code, but, unlike in the setPricingContext middleware for the store/products route, it was not expanding the customer into its customer groups. For this reason, the pricing module was not calculating the correct price for the variants. Fixes medusajs#10490
sergiocampama
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… lists Price lists may sometimes be bound to certain customer groups. The addToCartWorkflow and updateLineItemInCartWorkflow workflows were indeed accounting for the pricing context based on the cart's region, customer id and currency code, but, unlike in the setPricingContext middleware for the store/products route, it was not expanding the customer into its customer groups. For this reason, the pricing module was not calculating the correct price for the variants. Fixes medusajs#10490
sergiocampama
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… 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
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… 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
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… 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
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… 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
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… 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
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 8, 2024
… 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.
apologies for the notification spam, had the ticket id in the commit and did some pushes |
sergiocampama
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 10, 2024
… 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
added a commit
to sergiocampama/medusa
that referenced
this issue
Dec 10, 2024
… 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.
riqwan
added a commit
that referenced
this issue
Dec 12, 2024
… 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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Package.json file
Node.js version
20.15.0
Database and its version
PostgreSQL 16.4
Operating system name and version
Windows 11
Browser name
No response
What happended?
Clean installation of Medusa 2.1 + official storefront, without any changes in the code.
Problem:
The price of an item in the cart = always the full price of the product variand, not including the price list.
How to reproduce the problem:
Register as a customer on the storefront and authorize on the storefront.
In medusa backend, create a Customer group and add our customer to it.
In medusa backend, create two price lists: Sale type and Override type, make both price lists active by date and apply them to our Customer group. Assign prices to any product variant: sale = 7 eur, override = 5 eur.
On the storefront (being an authorized customer) we look at the prices for our product variant - everything works fine and we see the price of 5 eur. Add this variant to the cart.
Go to the cart and we see that the price of the cart is 10 eur (the full price of the product variant without price lists). This is the bug.
If we check the database, we see that
1)Cart is linked to our user
So this is not a storefront bug, but a bug in the core of Medusa.
Expected behavior
The price of the item in the shopping cart should match the price on the storefront.
Actual behavior
The price in the shopping cart is always the full price of the product without any price lists.
Link to reproduction repo
https://github.com/medusajs/medusa
The text was updated successfully, but these errors were encountered: