#Is there a way to batch update collections via workflow?

4 messages · Page 1 of 1 (latest)

mild snow
#

I have a workflow to create/update products and am using this workflow as a step:

batchProductsWorkflow.runAsStep({
   input: {
      create: productsToCreate,
      update: productsToUpdate,
   },
});

I have another workflow to create/update collections, but I see there is no batchCollectionsWorkflow. Is there a way to achieve the same thing as above? It doesn't look like looping updateCollectionsWorkflow within the workflow works.

sacred plover
#

if you look at the code of batch it just runs create/update/delete workflows as steps in parallel with parallelize step. The workflows already take batched data, the name is a bit misleading, it just parallelizes

mild snow
#

I see. That's because updateProductsWorkflow accepts an array of products, while updateCollectionsWorkflow only updates 1 collection at a time it looks like. It looks like I will have to customize it.

sacred plover
#

Oh I had no idea, I assumed they all accepted arrays. You should post an issue for that and any other inconsistencies you fiind in other workflows, ideally they should all accept an array.