fix: Product type tax overrides (#9951)

* fix: Make product type tax override work

* fix: Make product type tax override work
This commit is contained in:
Oli Juhl
2024-11-06 20:33:40 +01:00
committed by GitHub
parent aa78fbf546
commit 505768dd9f
35 changed files with 479 additions and 309 deletions
@@ -1,6 +1,6 @@
import { updateTaxLinesWorkflow } from "@medusajs/core-flows"
import { HttpTypes } from "@medusajs/framework/types"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { HttpTypes } from "@medusajs/framework/types"
import { refetchCart } from "../../helpers"
export const POST = async (
@@ -47,6 +47,7 @@ export const defaultStoreCartFields = [
"items.product.tags.id",
"items.product.collection_id",
"items.product.type_id",
"items.product_type_id",
"items.product_title",
"items.product_description",
"items.product_subtitle",
@@ -1,3 +1,8 @@
import {
MedusaRequest,
refetchEntities,
refetchEntity,
} from "@medusajs/framework/http"
import {
HttpTypes,
ItemTaxLineDTO,
@@ -5,11 +10,6 @@ import {
TaxableItemDTO,
TaxCalculationContext,
} from "@medusajs/framework/types"
import {
MedusaRequest,
refetchEntities,
refetchEntity,
} from "@medusajs/framework/http"
import { calculateAmountsWithTax, Modules } from "@medusajs/framework/utils"
import { TaxModuleService } from "@medusajs/tax/dist/services"
@@ -114,12 +114,6 @@ const asTaxItem = (product: HttpTypes.StoreProduct): TaxableItemDTO[] => {
return {
id: variant.id,
product_id: product.id,
product_name: product.title,
product_categories: product.categories?.map((c) => c.name),
// TODO: It is strange that we only accept a single category, revisit the tax module implementation
product_category_id: product.categories?.[0]?.id,
product_sku: variant.sku,
product_type: product.type,
product_type_id: product.type_id,
quantity: 1,
unit_price: variant.calculated_price.calculated_amount,