Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created February 13, 2020 06:00
Show Gist options
  • Select an option

  • Save webtoffee-git/347434951e5877451cc4cd8942f988f8 to your computer and use it in GitHub Desktop.

Select an option

Save webtoffee-git/347434951e5877451cc4cd8942f988f8 to your computer and use it in GitHub Desktop.
Export product images by WooCommerce additional variation images - WebToffee Product Import Export for WooCommerce
function webtoffee_export_additional_product_variation_images($row = array(), $pid = '', $header_row = array()) {
$key = array_search('"meta:woo_variation_gallery_images"', $header_row);
if (isset($row[$key]) && !empty($row[$key])) {
$attachment_ids = json_decode($row[$key]);
foreach ($attachment_ids as $id) {
$attached_file_url[] = wp_get_attachment_url($id);
}
$row[$key] = implode(',', $attached_file_url);
}
return $row;
}
add_filter('hf_alter_product_export_csv_data', 'webtoffee_export_additional_product_variation_images', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment