Creating child products from modifiers in batch


#1

Hi,

I am setting up my Moltin shop to sell photographies. These are created as products which I am now trying to add variations of size&material to alter price through modifiers. I have successfully created the modifiers, but now trying to attach to products and build child products in a larger scale. I would really appreciate help in how to execute such action in batch of ~2000 products.

Thank you,

Jesper


#2

Hi Jespercr,

We don’t batch process any work involved in product/child product administration. While it might be convenient, we don’t feel that there is sufficient protection against error (by that I mean error in data used to create modifiers etc etc - imagine getting a price modifier incorrect setting a price to $1 and that being applied to all you products!) so we have consciously erred away from batching.

That said…

If you have a set of variations that can be applied to all manner of products then you could write a batch script to perform these tasks for you. It would be a case of attaching the variations you have already created to each product and then hitting the /build endpoint.

You’re clearly already comfortable with interacting with the API directly so this should be a walk in the park for you. If however you do need some pointers don’t hesitate to ask - use this thread and whatever solutions come out will help others too!

Regards,

Ian


#3

Hi and thank you so much for your answer. Let me elaborate a little bit on what I am trying to do:

I am building an iPhone app in Swift to sell printed photography. Every photo comes with variations in size. These are priced differently, but should be showed in the same page in the app as variations.

Do you have any suggestion for how to build such script without working with individual product ID’s?

Thank you!!!

Jesper


#4

OK - apologies - I’m just asking these for clarification…

Are you asking how to administer creating child products by attaching variation(s) to base product(s) AND building the children in bulk?

  • this would require you to have created the necessary variation(s) with options and modifiers.
  • attach variation(s) to, and build, each product.

These may be helpful:

I can’t really provide any more help for this - you can use the API to get productIDs and variationIDs - this should give you enough to make the calls to attach the variations to the products and call build.

NOTE! You will be rate limited to around 15 reqs/sec so if you do batch script this make sure you can self throttle otherwise you’ll not have the relationships or builds complete successfully!


Are you asking how to display this to this information your customers so they can pic a product and then select the relevant sizes?

This is an example that was done early doors in the feature. I think the responses changed a little before it went into production but hopefully you will see what is going on.

the getChildID function is the one that uses the selections to pull the ID of the corresponding child product so that is probably the one to focus on.