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
@@ -144,7 +144,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.
|
||||
|
||||
@@ -260,9 +260,9 @@ The workflow accepts as an input the created cart and the `additional_data` para
|
||||
|
||||
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 cart 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 cart 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 call the workflow in the hook handler.
|
||||
|
||||
@@ -556,7 +556,7 @@ const created = when({
|
||||
// TODO update, or delete Custom record
|
||||
```
|
||||
|
||||
Using the `when-then` utility, you check if the cart 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 cart.
|
||||
Using `when-then`, you check if the cart 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 cart.
|
||||
|
||||
To create the `Custom` record, you use the `createCustomStep` you created in an earlier section.
|
||||
|
||||
@@ -589,7 +589,7 @@ const deleted = when({
|
||||
// TODO delete Custom record
|
||||
```
|
||||
|
||||
Using the `when-then` utility, you check if the cart 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 cart 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:
|
||||
|
||||
@@ -614,7 +614,7 @@ return new WorkflowResponse({
|
||||
})
|
||||
```
|
||||
|
||||
Using the `when-then` utility, you check if the cart 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 cart 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.
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ The Cart Module provides cart-related features in your Medusa and Node.js applic
|
||||
|
||||
## How to Use Cart Module's Service
|
||||
|
||||
You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART` imported from `@medusajs/framework/utils`.
|
||||
You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART`.
|
||||
|
||||
For example:
|
||||
|
||||
|
||||
Reference in new issue
Block a user