Skip to content

How to remove WooCommerce Variant Description in Bulk

  • by

Hello all!

In this article, we will learn how to delete all product descriptions in WooCommerce in bulk. First of all, make sure you have backed up your website before doing this. Because after doing this, you will not be able to restore your version descriptions unless you upload your backup. If you are ready, let’s get started!

The first thing you need to do is open your theme’s functions.php file. You can do this via your panel or with an FTP client.

Add the following code to the end of your functions.php file and wait a bit then delete it. That’s it! All variant descriptions of your products have been deleted.

function delete_all_variation_descriptions() {
    // Get all product variants
    $args = array(
        'post_type' => 'product_variation',
        'posts_per_page' => -1,
    );

    $variations = get_posts($args);

    foreach ($variations as $variation) {
        // Remove product variant description
        update_post_meta($variation->ID, '_variation_description', '');
    }
}
delete_all_variation_descriptions();

Leave a Reply

Your email address will not be published. Required fields are marked *