fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

How to add images to variation

Thang Nguyen

I want to add images to a variation (I have variation id) by code. Are there any hook or function to add directly by PHP?

Golam Kibria

Hi Thang,

Unfortunately, this feature is not currently available.

But we have complete support for the default export/import of WooCommerce.

You can import/add bulk images with your variations by using the default import option of WooCommerce.

Thank You

Thang Nguyen

No, just tell me how your plugins update images to variation? A function?

 

Is it to update gallery image ids?

update_post_meta( $variation_id, ‘woo_variation_gallery_images’, $gallery_image_ids );

Golam Kibria

Hi Thang,

Unfortunately, this feature is not currently available.

Will you please add your feature request here: https://storepress.fider.io/

BTW, here is the meta key that we use to store the images:- woo_variation_gallery_images

Thank You

Thang Nguyen

Thanks. Read plugin code and know how to update gallery ids for variation.

Golam Kibria

Hi Thang,

Could you please explain a bit more? I am sorry that I could not get your query.

Thank you

Thang Nguyen

I write a snippet for inserting images to variations automatically. So I have read your code and know how to update gallery ids for variation. Seem problem solved, thanks so much!

Golam Kibria

Hi Thang,

Wow man, you are truly awesome.

If it is alright I would love to have a look at the snippet.

Have a great day.

Thank You