Add Revision support to WooCommerce Products

WooCommerce Products make use of WordPress’s Custom Post Type feature, but one thing you’ll notice is missing is revision support. WooCommerce has deliberately omitted support for revisions because the majority of the content in a WooCommerce product is stored as metadata. The WordPress revisions system only covers post content which only covers the product description.

So even with revision support, product information such as price, shipping data, and everything else in the Product Data section would not be revisioned.

Sure, but I’d still like revisions for product descriptions

We have a customer that changes product descriptions on a regular basis and has had then need to go back and look at previous content. Here’s how we added support for product revisions on his site. Remember this will NOT save revisions for anything other than the main product description:

9/2/20 UPDATE: Use this new snippet:

/*
 * Add Revision support to WooCommerce Products
 * 
 */

add_filter( 'woocommerce_register_post_type_product', 'cinch_add_revision_support' );

function cinch_add_revision_support( $supports ) {
     $supports['supports'][] = 'revisions';

     return $supports;
}

Not this older version, it no longer works:

/*
 * Add Revision support to WooCommerce Products
 * 
 */

add_filter( 'woocommerce_register_post_type_product', 'cinch_add_revision_support' );

function cinch_add_revision_support( $args ) {
     $args['supports'][] = 'revisions';

     return $args;
}

Hopefully not the end of the story

There are plenty of people out there who would like to get revisions added to WooCommerce Products as a core feature. One way to do that would be for WordPress to implement revisioning for post meta. Let’s hope WordPress brings that to the table at some point.

Related posts

11 comments

Leave your comment