docs: use tooling convention across docs (#10512)
This commit is contained in:
1 parent
7c76ee24cb
commit
3409953c4f
76 files changed
+283
-265
No files matched your search
@@ -150,7 +150,7 @@ export default defineMiddlewares({
|
||||
})
|
||||
```
|
||||
|
||||
The `additional_data` parameter validation is customized using the `defineMiddlewares` utility function. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
|
||||
The `additional_data` parameter validation is customized using `defineMiddlewares`. In the routes middleware configuration object, the `additionalDataValidator` property accepts [Zod](https://zod.dev/) validaiton rules.
|
||||
|
||||
In the snippet above, you add a validation rule indicating that `custom_name` is a string that can be passed in the `additional_data` object.
|
||||
|
||||
@@ -266,9 +266,9 @@ The workflow accepts as an input the created product and the `additional_data` p
|
||||
|
||||
In the workflow, you:
|
||||
|
||||
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
|
||||
1. Use `transform` to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
|
||||
2. Create the `Custom` record using the `createCustomStep`.
|
||||
3. Use the `when-then` utility to link the product to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
|
||||
3. Use `when-then` to link the product to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/fundamentals/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
|
||||
|
||||
You'll next execute the workflow in the hook handler.
|
||||
|
||||
@@ -574,7 +574,7 @@ const created = when({
|
||||
// TODO update, or delete Custom record
|
||||
```
|
||||
|
||||
Using the `when-then` utility, you check if the product doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the product.
|
||||
Using `when-then`, you check if the product doesn't have a linked `Custom` record and the `custom_name` property is set. If so, you create a `Custom` record and link it to the product.
|
||||
|
||||
To create the `Custom` record, you use the `createCustomStep` you created in an earlier section.
|
||||
|
||||
@@ -607,7 +607,7 @@ const deleted = when({
|
||||
// TODO delete Custom record
|
||||
```
|
||||
|
||||
Using the `when-then` utility, you check if the product has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
|
||||
Using `when-then`, you check if the product has a linked `Custom` record and `custom_name` is `null` or an empty string. If so, you delete the linked `Custom` record and dismiss its links.
|
||||
|
||||
Finally, replace the new `TODO` with the following:
|
||||
|
||||
@@ -632,7 +632,7 @@ return new WorkflowResponse({
|
||||
})
|
||||
```
|
||||
|
||||
Using the `when-then` utility, you check if the product has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
|
||||
Using `when-then`, you check if the product has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record.
|
||||
|
||||
You return in the workflow response the created, updated, and deleted `Custom` record.
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ products.forEach((product) => {
|
||||
For each product variant, you:
|
||||
|
||||
1. Retrieve its tax lines from the `taxLinesMap`.
|
||||
2. Calculate its prices with and without taxes using the `calculateAmountsWithTax` function imported from `@medusajs/framework/utils`.
|
||||
2. Calculate its prices with and without taxes using the `calculateAmountsWithTax` from the Medusa Framework.
|
||||
3. The `calculateAmountsWithTax` function returns an object having two properties:
|
||||
- `priceWithTax`: The variant's price with the taxes applied.
|
||||
- `priceWithoutTax`: The variant's price without taxes applied.
|
||||
@@ -89,6 +89,6 @@ const { data: products } = await query.graph({
|
||||
|
||||
For the context of the product variant's calculated price, you pass an object to `context` with the property `variants`, whose value is another object with the property `calculated_price`.
|
||||
|
||||
`calculated_price`'s value is created using the `QueryContext` utility function, passing it a [calculation context object](../../../pricing/price-calculation/page.mdx#calculation-context).
|
||||
`calculated_price`'s value is created using `QueryContext` from the Modules SDK, passing it a [calculation context object](../../../pricing/price-calculation/page.mdx#calculation-context).
|
||||
|
||||
Each variant in the retrieved products has a `calculated_price` object. Learn more about its properties in [this Pricing Module guide](../../../pricing/price-calculation/page.mdx#returned-price-object).
|
||||
@@ -10,7 +10,7 @@ The Product Module provides product-related features in your Medusa and Node.js
|
||||
|
||||
## How to Use Product Module's Service
|
||||
|
||||
You can use the Product Module's main service by resolving from the Medusa container the resource `Modules.PRODUCT` imported from `@medusajs/framework/utils`.
|
||||
You can use the Product Module's main service by resolving from the Medusa container the resource `Modules.PRODUCT`.
|
||||
|
||||
For example:
|
||||
|
||||
|
||||
Reference in new issue
Block a user