You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/guides/developer-guide/custom-fields/index.md
+89-52Lines changed: 89 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Some use-cases for custom fields include:
18
18
* Adding a longitude and latitude to the `StockLocation` for use in selecting the closest location to a customer.
19
19
20
20
:::note
21
-
Custom fields are not solely restricted to Vendure's native entities though, it's also possible to add support for custom fields to your own custom entities. See: [Supporting custom fields](/guides/developer-guide/database-entity/#supporting-custom-fields)
21
+
Custom fields are not solely restricted to Vendure's native entities though, it's also possible to add support for custom fields to your own custom entities. See: [Supporting custom fields](/guides/developer-guide/database-entity/#supporting-custom-fields)
@@ -1247,7 +1246,6 @@ The various configuration options for each of the built-in form input (e.g. `su
1247
1246
1248
1247
If none of the built-in form input components are suitable, you can create your own. This is a more advanced topic which is covered in detail in the [Custom Form Input Components](/guides/extending-the-admin-ui/custom-form-inputs/) guide.
1249
1248
1250
-
1251
1249
## Tabbed custom fields
1252
1250
1253
1251
With a large, complex project, it's common for lots of custom fields to be required. This can get visually noisy in the UI, so Vendure supports tabbed custom fields. Just specify the tab name in the `ui` object, and those fields with the same tab name will be grouped in the UI! The tab name can also be a translation token if you need to support multiple languages.
Because custom fields are generated at run-time, TypeScript has no way of knowing about them based on your
@@ -1343,3 +1339,44 @@ One way to ensure that your custom field typings always get imported first is to
1343
1339
For a working example of this setup, see the [real-world-vendure repo](https://github.com/vendure-ecommerce/real-world-vendure/blob/master/src/plugins/reviews/types.ts)
1344
1340
:::
1345
1341
1342
+
## Special cases
1343
+
1344
+
Beyond adding custom fields to the corresponding GraphQL types, and updating paginated list sort & filter options, there are a few special cases where adding custom fields to certain entities will result in further API changes.
1345
+
1346
+
### OrderLine custom fields
1347
+
1348
+
When you define custom fields on the `OrderLine` entity, the following API changes are also automatically provided by Vendure:
1349
+
1350
+
- Shop API: [addItemToOrder](/reference/graphql-api/shop/mutations#additemtoorder) will have a 3rd input argument, `customFields`, which allows custom field values to be set when adding an item to the order.
1351
+
- Shop API: [adjustOrderLine](/reference/graphql-api/shop/mutations#additemtoorder) will have a 3rd input argument, `customFields`, which allows custom field values to be updated.
1352
+
- Admin API: the equivalent mutations for manipulating draft orders and for modifying and order will also have inputs to allow custom field values to be set.
1353
+
1354
+
:::info
1355
+
To see an example of this in practice, see the [Configurable Product guide](/guides/how-to/configurable-products/)
1356
+
:::
1357
+
1358
+
### Order custom fields
1359
+
1360
+
When you define custom fields on the `Order` entity, the following API changes are also automatically provided by Vendure:
1361
+
1362
+
- Admin API: [modifyOrder](/reference/graphql-api/admin/mutations#modifyorder) will have a `customFields` field on the input object.
1363
+
1364
+
### ShippingMethod custom fields
1365
+
1366
+
When you define custom fields on the `ShippingMethod` entity, the following API changes are also automatically provided by Vendure:
1367
+
1368
+
- Shop API: [eligibleShippingMethods](/reference/graphql-api/shop/queries#eligibleshippingmethods) will have public custom fields available on the result.
1369
+
1370
+
### PaymentMethod custom fields
1371
+
1372
+
When you define custom fields on the `PaymentMethod` entity, the following API changes are also automatically provided by Vendure:
1373
+
1374
+
- Shop API: [eligiblePaymentMethods](/reference/graphql-api/shop/queries#eligiblepaymentmethods) will have public custom fields available on the result.
1375
+
1376
+
### Customer custom fields
1377
+
1378
+
When you define custom fields on the `Customer` entity, the following API changes are also automatically provided by Vendure:
1379
+
1380
+
- Shop API: [registerCustomerAccount](/reference/graphql-api/shop/mutations#registercustomeraccount) will have have a `customFields` field on the input
0 commit comments