Title: Add image to gallery programmatically
Last modified: September 15, 2016

---

# Add image to gallery programmatically

 *  [leanwitzke](https://wordpress.org/support/users/leanwitzke/)
 * (@leanwitzke)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/add-image-to-gallery-programmatically/)
 * Hi.
    I want add images to product gallery with code php. But I do not know how.
   Somebody could help me?
 * Thank you so much

Viewing 1 replies (of 1 total)

 *  Thread Starter [leanwitzke](https://wordpress.org/support/users/leanwitzke/)
 * (@leanwitzke)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/add-image-to-gallery-programmatically/#post-8185885)
 * ok, i found the solution in the core of plugin.
 * Woocommerce manage field ‘_product_image_gallery’ with id of images separatly
   for comma.
 *     ```
       $list_id = "444,555";
       update_post_meta($post_id,'_product_image_gallery',$list_id);
       ```
   
 * Thanks
    -  This reply was modified 9 years, 10 months ago by [leanwitzke](https://wordpress.org/support/users/leanwitzke/).

Viewing 1 replies (of 1 total)

The topic ‘Add image to gallery programmatically’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [leanwitzke](https://wordpress.org/support/users/leanwitzke/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/add-image-to-gallery-programmatically/#post-8185885)
 * Status: not resolved