first, exporting and importing the products CSV means that I end up with a new category for every product I reimported (if I update 10 products of the Spices & Herbs category, then I end up with 10 categories called Spices & Herbs): my website is in English and Dutch, I tried importing the CSV using the English category name, the Dutch name, and [:en]/[:nl] tags, and it happens in every case.
second, I created some custom meta fields for my products (such as ingredients, storage, usage etc.), and they display correctly in both languages if I import everything from a CSV using the [:en]/[:nl] tags, but as soon as I edit them in Woocommerce product page, the new value overwrites both languages.
I guess this might have to do with the way I save out the meta fields, but I haven't been able to figure out how to do it so it works:
// Additional info Tab content in back-end
add_action('woocommerce_product_data_panels', 'additional_product_panels');
function additional_product_panels()
{
echo '
Hi, So I have two tiny problems with the plug-in:
// Create additional info Tab add_filter('woocommerce_product_data_tabs', 'LCLPC_additional_product_settings_tabs'); function LCLPC_additional_product_settings_tabs($tabs) { $tabs['additionnal'] = array( 'label' => 'Additional info', 'target' => 'additional_product_data', 'class' => ['hide_if_external'], 'priority' => 21 ); return $tabs; }
// Additional info Tab content in back-end add_action('woocommerce_product_data_panels', 'additional_product_panels'); function additional_product_panels() { echo '
}
//Save add_action('woocommerce_process_product_meta', function ($post_id) { $product = wc_get_product($post_id); $product->update_meta_data('usage', sanitize_text_field($_POST['usage'])); $product->update_meta_data('ingredients', sanitize_text_field($_POST['ingredients'])); $product->update_meta_data('allergens', sanitize_text_field($_POST['allergens'])); $product->update_meta_data('supplier', sanitize_text_field($_POST['supplier'])); $product->update_meta_data('storage', sanitize_text_field($_POST['storage'])); $product->update_meta_data('origin', sanitize_text_field($_POST['origin']));
});