on product added - hook into product afterInsert()

I would like to update/insert to a custom collection when I add a product. is there a hook that can call my function to update my collection and pass the product information to this function?

I have found these links but are not too helpful…

1 Like

Hey,
I asked the same question but had no answer :slight_smile:
You can add Hooks to products here in https://editor.wix.com Database section
You can use the Hook icon and add Hooks through here ( in image right side Hook icon)


or manually read this https://www.wix.com/code/reference/wix-data.Hooks.html#afterInsert

Hooks will work only on custom made collections as I tested, but I am not 100% sure.
Its sad that people who made this don’t reply to questions!

Yes I agree, anything requiring an ounce of actual functional coding not related to simple tasks is ignored or skipped.

Thank you for your advice. Yes, I agree it seems, as I feared, the hooks don’t seem to work on Wix’s prebuilt default collections within store - only on ones i set up!

hooks work on wix prebuilt collections, but the naming convention for the collection in the code is different than what is displayed in the collection dashboard. so in otherwords you have to find out how they prefixed the name of the collection. For example the wix Events collection is actually called “Events/Events” not just “Events”