Introduction

The WixDataBulkPatch methods enable you to specify the modifications you want to make in the specified data items. You can make multiple modifications in each item.

Build a bulk patch operation by calling the bulkPatch() method on the data items, and refine it by chaining WixDataBulkPatch 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:

  • You must chain at least one WixDataBulkPatch modification method before calling run().
  • You can only patch items in collections you have created. Items in Wix app collections cannot be patched.

For example, the following code patches a costume item by adding more sizes, removing a color option, and marking the item as available:

Copy
Did this help?

appendToArray( )


Developer Preview

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.

Method Declaration
Copy
Method Parameters
fieldNamestringRequired

valueanyRequired

Value to append to the specified array field.

Returns
Return Type:WixDataBulkPatch
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

incrementField( )


Developer Preview

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.

Method Declaration
Copy
Method Parameters
fieldNamestringRequired

bynumberRequired

Value by which to increment the specified field. You can specify positive or negative values.

Returns
Return Type:WixDataBulkPatch
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

removeField( )


Developer Preview

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.

Method Declaration
Copy
Method Parameters
fieldNamestringRequired
Returns
Return Type:WixDataBulkPatch
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

removeFromArray( )


Developer Preview

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.

Method Declaration
Copy
Method Parameters
fieldNamestringRequired

valueanyRequired

Value to remove from the specified array field.

Returns
Return Type:WixDataBulkPatch
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

run( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Runs the bulk patch operation and returns a Promise that resolves to information about the operation results.

Method Declaration
Copy
Method Parameters
optionsWixDataPatchOptions
Returns
Return Type:Promise<WixDataBulkResult>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

setField( )


Developer Preview

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.

Method Declaration
Copy
Method Parameters
fieldNamestringRequired

valueanyRequired

Value to set for the specified field.

Returns
Return Type:WixDataBulkPatch
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?