ID;
		$product_object = $thepostid ? wc_get_product( $thepostid ) : new WC_Product();
		wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
		?>
		
			
				get_gallery_image_ids( 'edit' );
				$attachments         = array_filter( $product_image_gallery );
				$update_meta         = false;
				$updated_gallery_ids = array();
				if ( ! empty( $attachments ) ) {
					foreach ( $attachments as $attachment_id ) {
						$attachment = wp_get_attachment_image( $attachment_id, 'thumbnail' );
						// if attachment is empty skip.
						if ( empty( $attachment ) ) {
							$update_meta = true;
							continue;
						}
						?>
						- 
							
							
							
						
 
						ID, '_product_image_gallery', implode( ',', $updated_gallery_ids ) );
					}
				}
				?>
			
			
		 
		
			
		
		set_gallery_image_ids( $attachment_ids );
		$product->save();
	}
}