• HI Kevin,

    We sell 10,000 products and we edit and crate products using the Woocommerce CSV import/export.

    This plugin has added 5,000+ columns into the CSV file when it’s exported from Woocommerce…so it crashes the server and Google Sheets and Apple Numbers are unable to open the CSV because the plugin created too many columns.

    How can we stop the plugin from creating so much data in the database?

    If we uninstall it, will it delete all database data to solve this issue? We don’t see any settings in it that “removes all data upon uninstall” like other plugins…and we don’t know how to stop it from overloading the database other than to remove it…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author kevinweber

    (@kevinweber)

    Hi @joyryde, thanks for reporting this. It’s been some time since I wrote the uninstallation script for this plugin and I wouldn’t be surprised if it’s not bullet-proof anymore. There might also be something specific about WooCommerce that could be tweaked in this plugin to prevent unintended additions of data to your export.

    Currently, when deactivating the plugin, all oembed entries should be removed from the database:

    static function delete_oembed_caches() {
    
    global $wpdb;
    
    $meta_key_1 = "|_oembed|_%%";
    
    $meta_key_2 = "|_oembed|_time|_%%";
    
    $wpdb->query(
    
    $wpdb->prepare(
    
    "DELETE FROM ".$wpdb->postmeta."
    
    WHERE meta_key LIKE %s ESCAPE '|'
    
    OR meta_key LIKE %s ESCAPE '|'",
    
    $meta_key_1,
    
    $meta_key_2
    
    )
    
    );
    
    // Flush all transient oembed caches. Those are used by the block editor.
    
    // @since 2.9.0
    
    $option_name_1 = "|_transient|_oembed|_%%";
    
    $option_name_2 = "|_transient|_timeout|_oembed|_%%";
    
    $wpdb->query(
    
    $wpdb->prepare(
    
    "DELETE FROM ".$wpdb->options."
    
    WHERE option_name LIKE %s ESCAPE '|'
    
    OR option_name LIKE %s ESCAPE '|'",
    
    $option_name_1,
    
    $option_name_2
    
    )
    
    );
    
    }

    When uninstalling the plugin (after deactivating), two things happen:

    1. Clear all oembed caches
    2. Delete all post-specific metadata added by this plugin:
    static function delete_postmeta() {
    
    global $wpdb;
    
    $meta_key_1 = "lazyload_thumbnail_quality";
    
    $wpdb->query(
    
    $query = $wpdb->prepare(
    
    "DELETE FROM ".$wpdb->postmeta."
    
    WHERE meta_key = %s",
    
    $meta_key_1
    
    )
    
    );
    
    }

    My recommendation would be to simply try and see what happens if you deactivate the plugin. Does that fix your WooCommerce issue?

    Thread Starter joyryde

    (@joyryde)

    Do you think we should remove the plugin due to the number of columns it’s creating in the exports to make it easier to work in Woocommerce? Or is there a way to have the plugin put all of the data into just one column instead of 5,000-10,000 columns?

    We love the plugin and it helps with page loading, but the way it’s implemented is tough with large websites like ours!

    Plugin Author kevinweber

    (@kevinweber)

    @joyryde You got lucky! I was motivated to squeeze in some plugin updates today. Please check out v2.18.0 and see if that fixes your issue. I implemented a solution that should prevent oembed metadata from getting exported in WooCommerce product CSVs.

    Thread Starter joyryde

    (@joyryde)

    Thank you Kevin!

    I appreciate your amazing help as always! I will see how it goes on our next large CSV export this week.

    • This reply was modified 7 months, 3 weeks ago by joyryde.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Thousands of columns in the database when exporting Woocommerce products to CSV’ is closed to new replies.