The WixDataPatch
methods enable you to specify the modifications you want to make in a data item. You can make multiple modifications in a single patch operation.
Build a patch operation by calling the patch()
method on the data item, and refine it by chaining WixDataPatch
modification methods. You can set or increment a field value, as well as add or remove items from an array field. The methods are applied in the order in which they are chained.
Finally, run the patch operation by calling run()
.
Notes:
WixDataPatch
modification method before calling run()
.For example, the following code patches a costume item by adding more sizes, removing a color option, and marking the item as available:
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Refines a patch operation to append the specified value to the specified array field.
Value to append to the specified array field.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Refines a patch operation to increment the specified field by the specified value.
Value by which to increment the specified field. You can specify positive or negative values.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Refines a patch operation to clear the specified field.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Refines a patch operation to remove the specified value from the specified array field.
Value to remove from the specified array field.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Runs the patch operation and returns the patched item.
The run()
method returns a Promise that resolves to the patched item and item metadata.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Refines a patch operation to set the specified field to the specified value.
Value to set for the specified field.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.