fix: Ensure tax lines are generated for all items and shipping methods in cart (#10372)
* fix: Generate tax lines for all items in cart * fix: Correct test
This commit is contained in:
@@ -132,7 +132,7 @@ export const addShippingMethodToCartWorkflow = createWorkflow(
|
||||
return cart.shipping_methods.map((sm) => sm.id)
|
||||
})
|
||||
|
||||
const [, shippingMethodsToAdd] = parallelize(
|
||||
parallelize(
|
||||
removeShippingMethodFromCartStep({
|
||||
shipping_method_ids: currentShippingMethods,
|
||||
}),
|
||||
@@ -148,7 +148,6 @@ export const addShippingMethodToCartWorkflow = createWorkflow(
|
||||
updateTaxLinesWorkflow.runAsStep({
|
||||
input: {
|
||||
cart_id: input.cart_id,
|
||||
shipping_methods: shippingMethodsToAdd,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -133,7 +133,6 @@ export const addToCartWorkflow = createWorkflow(
|
||||
updateTaxLinesWorkflow.runAsStep({
|
||||
input: {
|
||||
cart_id: input.cart.id,
|
||||
items,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export const refreshCartItemsWorkflow = createWorkflow(
|
||||
return items
|
||||
})
|
||||
|
||||
const items = updateLineItemsStep({
|
||||
updateLineItemsStep({
|
||||
id: cart.id,
|
||||
items: lineItems,
|
||||
})
|
||||
@@ -103,7 +103,7 @@ export const refreshCartItemsWorkflow = createWorkflow(
|
||||
refreshCartShippingMethodsStep({ cart: refetchedCart })
|
||||
|
||||
updateTaxLinesWorkflow.runAsStep({
|
||||
input: { cart_id: cart.id, items },
|
||||
input: { cart_id: cart.id },
|
||||
})
|
||||
|
||||
const cartPromoCodes = transform({ cart, input }, ({ cart, input }) => {
|
||||
|
||||
@@ -86,9 +86,8 @@ export const updateTaxLinesWorkflow = createWorkflow(
|
||||
const taxLineItems = getItemTaxLinesStep(
|
||||
transform({ input, cart }, (data) => ({
|
||||
orderOrCart: data.cart,
|
||||
items: data.input.items || data.cart.items,
|
||||
shipping_methods:
|
||||
data.input.shipping_methods || data.cart.shipping_methods,
|
||||
items: data.cart.items,
|
||||
shipping_methods: data.cart.shipping_methods,
|
||||
force_tax_calculation: data.input.force_tax_calculation,
|
||||
}))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user