I’m trying to write a script to automatically create a new product for each image that is added to the media manager using metadata on the image. I was hoping I could use createProduct() every time the uploadImage() event is called but it seems events don’t work in preview mode and it doesn’t look like I can add images via the media manager when I’m not in preview mode.
Can someone suggest a workaround to this issue?
Hi,
If I am not mistaken, I understand that you would like to add an image to the media manager when you are on the live site and once the image is added to the media manager, you would like that product to be created.
You wouldn’t be able to open the media manager on the live site to upload the image, but a workaround can be to create a form that allows you to upload an image.
You can try creating a form that allows you to upload an image with an upload button and then when the form is fill out and submitted, you can decide what happens next with createProduct() or your uploadImage() function.
For a tutorial on using the upload button with code, click here .
Best Regards,
Edward
I had considered that but it seems super slow. We need to do this for 3k