fix: Update tax lines on cart when region changes (#9367)

**What**
- Removes broken cart retrieval step `retrieveWithCartLinks` in favor of `useRemoteQueryStep` in `updateTaxLinesWorkflows`

**Why**
- Filters variables in the step were passed with an incorrect shape
  - I removed the step, since it's only used once and the behavior is identical to the generic remote query step

**Note**
- Because the filters were passed incorrectly, the, now-removed, step has always returned the first cart in the database. As a result all tax calculations so far have been based on whatever the shape of that cart has. It basically ignores all input to this workflow
This commit is contained in:
Oli Juhl authored and GitHub committed 2024-09-30 11:55:54 +00:00
1 parent 852df3f764
commit 8851ae7b51
9 files changed
+151 -63

No files matched your search

@@ -1,17 +1,15 @@
import { updateTaxLinesWorkflow } from "@medusajs/core-flows"
import { HttpTypes } from "@medusajs/framework/types"
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
import { refetchCart } from "../../helpers"
import { HttpTypes } from "@medusajs/framework/types"
export const POST = async (
req: MedusaRequest,
res: MedusaResponse<HttpTypes.StoreCartResponse>
) => {
const workflow = updateTaxLinesWorkflow(req.scope)
await workflow.run({
await updateTaxLinesWorkflow(req.scope).run({
input: {
cart_or_cart_id: req.params.id,
cart_id: req.params.id,
force_tax_calculation: true,
},
})