This topic has 8 replies, 3 voices, and was last updated 2 years, 2 months ago ago by Rose Tyler
Hello,
Is there any solution yet to upload variations gallery images with CSV? I have hundreds of products, and it’s impossible and very time-consuming to upload the images of the variations manually.
Thank you.
Hello, @Nick,
Variation gallery is an additional feature of the theme and the default WooCommerce plugin export file does not include that info for import. So, try to use other export plugins like WP All export/WP all import or similar that allow choosing what fields you want to export including custom fields.
Regards 8Themes Team.
Do you know for sure if WP all import or any other plugin has the functionality to upload variations gallery?
Hello, @Nick,
You can try with WP all import plugin and please read the plugin’s official doc here: https://www.wpallimport.com/documentation/import-variable-products-woocommerce/ it will help you in understanding about plugin more deeply.
Regards 8Themes Team.
Hello,
I have bought the plugin, and it doesn’t support the plugin that you are using for the variations gallery.
However, it mentions that:
If you use a different plugin to enable multiple variation images, you can write custom code that uses our pmxi_gallery_image hook to import the images into it.
https://www.wpallimport.com/documentation/action-reference/#pmxi_gallery_image
Is there any chance to provide a solution?
Thank you.
Hello,
We don’t guarantee full compatibility with all plugins but we can always try to add it with the ones our customers ask us for 🙂
In your case, I would recommend you to check the next topics where customers wanted to import/export our variation gallery images with some extra plugins.
1/ https://www.8theme.com/topic/product-variation-images-generating-in-xml-file/ (after that topic was solved we added globally compatibility with WooCommerce Skroutz & BestPrice XML Feed plugin)
2/ https://www.8theme.com/topic/some-questions-about-variations-gallery/
We would recommend you to ask plugin’s support with the details we provided below. If you will get a positive answer from them – you may write us with details they gave you so that we could add their ‘snippet/filter/action’ globally for all other clients and add compatibility with that plugin for all others 🙂
For information to your plugin’s developers (you may ask them for help):
1/ Our theme field name is ‘et_variation_gallery_images’ (to get variation gallery for any product variation we used next line of php code -> get_post_meta( $product->get_id(), ‘et_variation_gallery_images’, true ); Note: $product should be defined or global variable )
2/ If you check xstore/framework/woo.php you may find how we added compatibility with WooCommerce Skroutz & BestPrice XML Feed plugin (please, look for the ‘etheme_compatibility_webexpert_skroutz_xml_variation_gallery_images’ function )
Otherwise, if you cannot contact with plugin’s authors to ask them for ‘How to make import of custom field ‘et_variation_gallery_images’, you may provide admin+ftp access in the private content area and we will try to help you.
Regards
Hello,
Sorry for the late reply. So here are the instructions.
They told me that to export the variation images I have to convert them from ids to filenames using a custom code like this in the field et_variation_gallery_images:
<?php
function my_fix_images( $ids ) {
if ( empty( $ids ) ) return;
$ids = maybe_unseriaze( $ids );
array_walk( $ids, function( &$id ) {
$id = wp_get_attachment_url( $id );
} );
return implode( ',', $ids );
}
?>
And in the plugin’s import settings I have to put a code like this:
<?php
function gallery_n_id($post_id, $att_id, $filepath, $is_keep_existing_images = '')
{
// The custom field used for the gallery.
$key = 'et_variation_gallery_images';
// Retrieve existing gallery values.
$gallery = get_post_meta($post_id, $key, TRUE);
// If gallery is empty declare a new array.
if (empty($gallery)) {
$gallery = array();
}
// Check if the image is in the gallery.
if (!in_array($att_id, $gallery)) {
// If not, add it.
$gallery[] = (int) $att_id;
// Save the new gallery.
update_post_meta($post_id, $key, $gallery);
}
}
add_action('pmxi_gallery_image', 'gallery_n_id', 10, 4)
?>
Could you help me with the exact code etc?
Thank you.
Hello,
Please try to do this by yourself first, because additional customization is out of our basic support scope. Follow the instruction you got and ask for further assistance from the plugin support side.
Otherwise, provide admin+ftp access in the private content area here and I will ask one of our developers to take a closer look at this topic (without access we can’t help you) (it will take some time because we have a lot of requests these days).
Regards
Tagged: import, json, product gallery, variations, woocommerce, wordpress
The issue related to '‘Import variations product gallery with csv’' has been successfully resolved, and the topic is now closed for further responses