• Resolved Delia Carballo

    (@soydelia)


    Hello,

    When using the built-in WooCommerce exporter, the new field “GTIN, UPC, EAN, or ISBN” is not being exported. Could you please assist in resolving this issue?

    Thank you in advance for your help.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Stef

    (@serafinnyc)

    Hello @soydelia by default those are not fields that WooCommerce core comes with. You must be using a 3rd party extension to add those and we do not support 3rd party extensions here. This forum is for WooCommerce core only.

    What you’ll want to do is find an export app that can grab any custom tables/rows/headers that you’ve added with 3rd Party extensions. There are several out there. I’m a fan personally of WP Sheets.

    Thread Starter Delia Carballo

    (@soydelia)

    Hello @serafinnyc

    According to this information, WC has incorporated this field in version 9.2:
    https://developer.woocommerce.com/2024/08/21/woocommerce-9-2-a-better-experience-for-all-users/#:~:text=Classic%20Product%20Editor,products%20and%20variations.

    The WP All Export plugin detects it as a custom field with the ID _global_unique_id, but I think that the built-in WC exporter should export it along with the rest of WC’s native fields.

    That’s why I’m raising the question in the WC forum ??

    Same problem here. WooCommerce exporter don’t export this new (native) GTIN field :/

    @soydelia, @fernandot

    You may use the below code snippet until it’s available in the default export, for exporting the newly introduced GTIN, UPC, EAN, or ISBN field. Add the code in the active theme functions.php

    add_filter('woocommerce_product_export_row_data', 'woocommerce_product_export_row_data', 10, 3);

    function woocommerce_product_export_row_data($row, $product, $exporter) {

    $row['meta:__global_unique_id'] = get_post_meta($product->get_id(), '_global_unique_id', true);
    return $row;
    }

    add_filter('woocommerce_product_export_column_names', 'woocommerce_product_export_column_names', 10, 2);

    function woocommerce_product_export_column_names($column_names, $exporter) {

    $column_names['meta:__global_unique_id'] = 'global_unique_id';
    return $column_names;
    }

    I suggest you look into the?Import Export Suite for WooCommerce.
    This extension offers a wide range of features related to the import and export of WooCommerce data.

    Thank you so much @mujuonly

    I’ll try both suggestions and share the result ??

    Thread Starter Delia Carballo

    (@soydelia)

    Thank you @mujuonly I’ll try that code ??

    Stef

    (@serafinnyc)

    Ah sorry about that @soydelia I didn’t get the memo last week. My bad.

    The code that @mujuonly provided was off just a tad. So it might not return a value. I’ve revised it here:

    add_filter('woocommerce_product_export_column_names', 'add_custom_gtin_export_column');
    function add_custom_gtin_export_column($columns) {
    $columns['global_unique_id'] = 'GTIN/UPC/EAN/ISBN';
    return $columns;
    }

    add_filter('woocommerce_product_export_product_row', 'add_custom_gtin_export_row', 10, 3);
    function add_custom_gtin_export_row($row, $product, $product_id) {
    $gtin_value = get_post_meta($product_id, '_global_unique_id', true);

    $row['global_unique_id'] = !empty($gtin_value) ? $gtin_value : '';

    return $row;
    }

    This should work and return a value. Let me know.

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @mujuonly,

    Thank you for the code snippet, I just tried it and I can confirm it works!

    Direct link to the image: https://snipboard.io/LxDnQC.jpg

    Cheers!
    -OP

    christianpon

    (@christianpon)

    Excellent stuff! Should we expect this field to be included in the native export/import function in the near future? The export snippet works fine but when I’m trying to create a snippet for import everything seems to be fine on the surface but no values are imported to the GTIN fields across simple products and variations. Would anyone have a snippet also for import?

    Many thanks,
    Christian P

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello christianpon,

    Thank you for your reply.

    The code you’re using was shared by a WooCommerce community member, and according to our policy, we’re unable to provide support for custom code.

    I recommend reaching out to the person who shared the snippet for further assistance.
    Alternatively, you can consult a developer through Codeable or WooExperts for more specialized help.

    Let us know if you have any other questions!

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.