Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @kimruddock,

    You can import related products using CSV by including the product IDs of related product in columns named _crp_related_ids. While importing make sure to choose “Import as metadata” while mapping CSV columns.

    Leave us a review, if you like the plugin.

    Thread Starter kimruddock

    (@kimruddock)

    How do I import multiple IDs under the _crp_related_ids column? I’ve tried comma-separating the ids in the CSV but they are just imported as a single string.

    Thread Starter kimruddock

    (@kimruddock)

    Could you please advise as per my issue above? At the moment I cannot relate more than one product id to each product via CSV.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @kimruddock,

    We can help with that.

    Firstly, copy below code snippet to your active theme’s function.php

    add_filter('woocommerce_product_importer_parsed_data', 'woocommerce_product_importer_parsed_data',10,2);
    
    function woocommerce_product_importer_parsed_data($data,$d_data) {
       foreach ($data['meta_data'] as $mkey => $mvalue) {
           if ($mvalue['key'] == '_crp_related_ids') {
               $custom_meta = explode(",", $mvalue['value']);
               $en_value = json_encode($custom_meta, JSON_NUMERIC_CHECK);
               $custom_meta_data = json_decode($en_value, true);          
               $data['meta_data'][$mkey]['value'] = $custom_meta_data;
           }
       }
       return $data;
    }

    Then use the column “Meta:_crp_related_ids” in import CSV with the IDs comma separated.

    Eg:
    Meta:_crp_related_ids
    1001, 1002

    Thread Starter kimruddock

    (@kimruddock)

    Many thanks, this has worked.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @kimruddock,

    Great. Please leave a review if you like the plugin.

    Hello,
    Is it also possible to add related products by sku?
    Is there, or can I create, a meta field like: _crp_related_skus ?

    thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘CSV Import Compatibility’ is closed to new replies.