From 6f83dbc0199188f97659ea2fd5c4e92f89290dd8 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 17 Apr 2025 18:29:39 +0300 Subject: [PATCH] chore: fixes and updates to promotion and shipping option TSDocs (#12222) --- .../src/fulfillment/steps/add-shipping-options-prices.ts | 7 +++++++ .../src/fulfillment/workflows/create-shipping-options.ts | 7 +++++++ .../src/fulfillment/workflows/update-shipping-options.ts | 7 +++++++ .../src/product/workflows/create-product-variants.ts | 7 +++++++ .../core-flows/src/product/workflows/create-products.ts | 7 +++++++ .../src/product/workflows/update-product-variants.ts | 7 +++++++ .../core-flows/src/product/workflows/update-products.ts | 7 +++++++ .../src/promotion/workflows/create-promotions.ts | 1 + packages/core/types/src/promotion/service.ts | 6 ++++++ 9 files changed, 56 insertions(+) diff --git a/packages/core/core-flows/src/fulfillment/steps/add-shipping-options-prices.ts b/packages/core/core-flows/src/fulfillment/steps/add-shipping-options-prices.ts index 27f128715c..86b847236a 100644 --- a/packages/core/core-flows/src/fulfillment/steps/add-shipping-options-prices.ts +++ b/packages/core/core-flows/src/fulfillment/steps/add-shipping-options-prices.ts @@ -125,6 +125,13 @@ export const createShippingOptionsPriceSetsStepId = "add-shipping-options-prices-step" /** * This step creates price sets for one or more shipping options. + * + * :::note + * + * Learn more about adding rules to the shipping option's prices in the Pricing Module's + * [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation. + * + * :::note */ export const createShippingOptionsPriceSetsStep = createStep( createShippingOptionsPriceSetsStepId, diff --git a/packages/core/core-flows/src/fulfillment/workflows/create-shipping-options.ts b/packages/core/core-flows/src/fulfillment/workflows/create-shipping-options.ts index 1f566b2d63..4353392f19 100644 --- a/packages/core/core-flows/src/fulfillment/workflows/create-shipping-options.ts +++ b/packages/core/core-flows/src/fulfillment/workflows/create-shipping-options.ts @@ -31,6 +31,13 @@ export const createShippingOptionsWorkflowId = * @example * To calculate a shipping option with flat rate prices: * + * :::note + * + * Learn more about adding rules to the shipping option's prices in the Pricing Module's + * [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation. + * + * :::note + * * ```ts * const { result } = await createShippingOptionsWorkflow(container) * .run({ diff --git a/packages/core/core-flows/src/fulfillment/workflows/update-shipping-options.ts b/packages/core/core-flows/src/fulfillment/workflows/update-shipping-options.ts index 667aeff3b8..3f97a5253a 100644 --- a/packages/core/core-flows/src/fulfillment/workflows/update-shipping-options.ts +++ b/packages/core/core-flows/src/fulfillment/workflows/update-shipping-options.ts @@ -28,6 +28,13 @@ export const updateShippingOptionsWorkflowId = * You can use this workflow within your own customizations or custom workflows, allowing you to * update shipping options within your custom flows. * + * :::note + * + * Learn more about adding rules to the shipping option's prices in the Pricing Module's + * [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation. + * + * :::note + * * @example * const { result } = await updateShippingOptionsWorkflow(container) * .run({ diff --git a/packages/core/core-flows/src/product/workflows/create-product-variants.ts b/packages/core/core-flows/src/product/workflows/create-product-variants.ts index 123464fad7..712982ec57 100644 --- a/packages/core/core-flows/src/product/workflows/create-product-variants.ts +++ b/packages/core/core-flows/src/product/workflows/create-product-variants.ts @@ -207,6 +207,13 @@ export const createProductVariantsWorkflowId = "create-product-variants" * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around product-variant creation. * + * :::note + * + * Learn more about adding rules to the product variant's prices in the Pricing Module's + * [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation. + * + * :::note + * * @example * const { result } = await createProductVariantsWorkflow(container) * .run({ diff --git a/packages/core/core-flows/src/product/workflows/create-products.ts b/packages/core/core-flows/src/product/workflows/create-products.ts index d5469c7efb..834ef2e891 100644 --- a/packages/core/core-flows/src/product/workflows/create-products.ts +++ b/packages/core/core-flows/src/product/workflows/create-products.ts @@ -108,6 +108,13 @@ export const createProductsWorkflowId = "create-products" * This workflow has a hook that allows you to perform custom actions on the created products. You can see an example in [this guide](https://docs.medusajs.com/resources/commerce-modules/product/extend). * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around product creation. + * + * :::note + * + * Learn more about adding rules to the product variant's prices in the Pricing Module's + * [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation. + * + * :::note * * @example * const { result } = await createProductsWorkflow(container) diff --git a/packages/core/core-flows/src/product/workflows/update-product-variants.ts b/packages/core/core-flows/src/product/workflows/update-product-variants.ts index 03c38422e9..ea101d91f7 100644 --- a/packages/core/core-flows/src/product/workflows/update-product-variants.ts +++ b/packages/core/core-flows/src/product/workflows/update-product-variants.ts @@ -57,6 +57,13 @@ export const updateProductVariantsWorkflowId = "update-product-variants" * allows you to update custom data models linked to the product variants. * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around product-variant update. + * + * :::note + * + * Learn more about adding rules to the product variant's prices in the Pricing Module's + * [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation. + * + * :::note * * @example * To update product variants by their IDs: diff --git a/packages/core/core-flows/src/product/workflows/update-products.ts b/packages/core/core-flows/src/product/workflows/update-products.ts index 5cd61245a5..f8a58c2a7e 100644 --- a/packages/core/core-flows/src/product/workflows/update-products.ts +++ b/packages/core/core-flows/src/product/workflows/update-products.ts @@ -343,6 +343,13 @@ export const updateProductsWorkflowId = "update-products" * allows you to update custom data models linked to the products. * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around product update. + * + * :::note + * + * Learn more about adding rules to the product variant's prices in the Pricing Module's + * [Price Rules](https://docs.medusajs.com/resources/commerce-modules/pricing/price-rules) documentation. + * + * :::note * * @example * To update products by their IDs: diff --git a/packages/core/core-flows/src/promotion/workflows/create-promotions.ts b/packages/core/core-flows/src/promotion/workflows/create-promotions.ts index a69ede0f25..f46b25bf70 100644 --- a/packages/core/core-flows/src/promotion/workflows/create-promotions.ts +++ b/packages/core/core-flows/src/promotion/workflows/create-promotions.ts @@ -34,6 +34,7 @@ export const createPromotionsWorkflowId = "create-promotions" * { * code: "10OFF", * type: "standard", + * status: "active", * application_method: { * type: "percentage", * target_type: "items", diff --git a/packages/core/types/src/promotion/service.ts b/packages/core/types/src/promotion/service.ts index 2266cf1379..5795ea5229 100644 --- a/packages/core/types/src/promotion/service.ts +++ b/packages/core/types/src/promotion/service.ts @@ -123,6 +123,7 @@ export interface IPromotionModuleService extends IModuleService { * { * code: "50OFF", * type: "standard", + * status: "active", * application_method: { * type: "percentage", * target_type: "items", @@ -132,6 +133,7 @@ export interface IPromotionModuleService extends IModuleService { * { * code: "FREESHIPPING", * type: "standard", + * status: "active", * application_method: { * type: "percentage", * target_type: "shipping_methods", @@ -141,6 +143,7 @@ export interface IPromotionModuleService extends IModuleService { * { * code: "BUY2GET1", * type: "buyget", + * status: "active", * application_method: { * type: "fixed", * target_type: "items", @@ -173,6 +176,7 @@ export interface IPromotionModuleService extends IModuleService { * const promotionA = await promotionModuleService.createPromotions({ * code: "50OFF", * type: "standard", + * status: "active", * application_method: { * type: "percentage", * target_type: "items", @@ -183,6 +187,7 @@ export interface IPromotionModuleService extends IModuleService { * const promotionB = await promotionModuleService.createPromotions({ * code: "FREESHIPPING", * type: "standard", + * status: "active", * application_method: { * type: "percentage", * target_type: "shipping_methods", @@ -193,6 +198,7 @@ export interface IPromotionModuleService extends IModuleService { * const promotionC = await promotionModuleService.createPromotions({ * code: "BUY2GET1", * type: "buyget", + * status: "active", * application_method: { * type: "fixed", * target_type: "items",