feat(medusa): Adds product variant sale price (#148)
* feat(medusa): Adds product variant sale price * fix(medusa-plugin-content): Always update prices in contentful
This commit is contained in:
@@ -20,6 +20,7 @@ export default async (req, res) => {
|
||||
.items({
|
||||
currency_code: Validator.string().required(),
|
||||
amount: Validator.number().required(),
|
||||
sale_amount: Validator.number().optional(),
|
||||
})
|
||||
.required(),
|
||||
options: Validator.array()
|
||||
|
||||
@@ -10,6 +10,7 @@ export default async (req, res) => {
|
||||
.items({
|
||||
currency_code: Validator.string().required(),
|
||||
amount: Validator.number().required(),
|
||||
sale_amount: Validator.number().optional(),
|
||||
})
|
||||
.required(),
|
||||
options: Validator.array()
|
||||
|
||||
@@ -31,6 +31,7 @@ export default async (req, res) => {
|
||||
region_id: Validator.string(),
|
||||
currency_code: Validator.string(),
|
||||
amount: Validator.number().required(),
|
||||
sale_amount: Validator.number().optional(),
|
||||
})
|
||||
.xor("region_id", "currency_code")
|
||||
),
|
||||
|
||||
@@ -13,6 +13,7 @@ export default async (req, res) => {
|
||||
region_id: Validator.string(),
|
||||
currency_code: Validator.string(),
|
||||
amount: Validator.number().required(),
|
||||
sale_amount: Validator.number().optional(),
|
||||
})
|
||||
.xor("region_id", "currency_code")
|
||||
),
|
||||
@@ -45,13 +46,15 @@ export default async (req, res) => {
|
||||
await productVariantService.setRegionPrice(
|
||||
variant_id,
|
||||
price.region_id,
|
||||
price.amount
|
||||
price.amount,
|
||||
price.sale_amount || undefined
|
||||
)
|
||||
} else {
|
||||
await productVariantService.setCurrencyPrice(
|
||||
variant_id,
|
||||
price.currency_code,
|
||||
price.amount
|
||||
price.amount,
|
||||
price.sale_amount || undefined
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user