• Resolved rockysaxxx

    (@rockysaxxx)


    Hi,

    I noticed that when you import a csv with your products including all the meta fields, ALL the custom fields are set to EVERY product (with empty values for the products, where no value was set in the csv). How can I prevent this? For example, I have field for EAN number. So if I upload the csv, the EAN custom field will get set for every product, even though I only need it for specific products where I have actually entered a value for.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Grigorij S. a11n

    (@grigaswp)

    Hi @rockysaxxx,

    I understand that you’d like to avoid assigning empty custom fields to some of the products during import.

    During import, you can select “do not import” next to a specific field, however, that will apply to all products and it isn’t possible to selectively exclude products, unless you exclude the whole product from the import.

    Excluding the products you don’t need this field imported for from your .csv file sounds like the only viable workaround here.

    You could import these products from a different file and skip that custom field.

    Let me know if that helps!

    Thread Starter rockysaxxx

    (@rockysaxxx)

    @grigaswp No, that does not work – if you have 15 custom fields for 1000+ products and then have to select each group for each field where you don’t want each of the fields imported…that would take forever! I tried this

    add_filter('update_post_metadata', function($check, $object_id, $meta_key, $meta_value, $prev_value)   {
    if(strpos($meta_key, 'my_key')) {
        if(empty($meta_value)) {
            delete_post_meta($object_id, $meta_key, $prev_value);
            return true;
        }
    }
    return null;
    }, 10, 5);

    but it does not seem to work.

    Plugin Support Tseten a11n

    (@tibetanitech)

    Hi @rockysaxxx,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Please kindly note that this requires some custom coding – which goes beyond the scope of support we are able to provide in this forum.

    If you do require more help with the actual coding, we’d recommend you hire a developer who can take a look at this, quote you for their services, and help you add this feature to your site. We’d recommend getting in touch with a web developer or one of the customization experts listed at https://woocommerce.com/customizations/.

    I’m going to go ahead and set this to resolved.
    I would suggest you take a look at the links mentioned above if any additional assistance is needed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom fields and csv import’ is closed to new replies.