WooCommerce is primarily built for eCommerce, with products being the main content type. However, there may be scenarios where you want to convert your WooCommerce products into regular blog posts for a variety of reasons, such as turning product pages into informative articles, reviews, or updates on discontinued products.
In this guide, we’ll walk you through how to change WooCommerce products into WordPress posts without using a plugin. This can be a useful solution if you’re repurposing product content or adjusting your store’s structure. As always, remember to use a child theme to ensure your customisations are safe from future updates.
Why Change WooCommerce Products to Posts?
There are many reasons why you may want to convert WooCommerce products into posts:
- Content Repurposing: Convert discontinued products into blog posts or articles that provide valuable information.
- SEO Benefits: Optimise the content of former product pages as blog posts to drive traffic via organic search.
- Store Restructuring: If you’re moving away from selling products but still want to keep the information on your site, converting products to posts can be useful.
Custom Code to Change WooCommerce Products to Posts
The following code snippet allows you to change WooCommerce products into WordPress posts. Add this code to your theme’s functions.php file or use a child theme to ensure changes persist through theme updates.
Step 1: Convert Products to Posts
This function converts the post type of your WooCommerce products (product) into the default WordPress post type (post).
/*
* Snippet: How to Change Products to Posts in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1538
* Tested with WooCommerce 10.7.0
* "This function converts WooCommerce products to WordPress posts"
*/
function wcsuccess_convert_products_to_posts() {
global $wpdb;
// Update the post type from 'product' to 'post'
$wpdb->query( "
UPDATE $wpdb->posts
SET post_type = 'post'
WHERE post_type = 'product'
" );
}
add_action( 'init', 'wcsuccess_convert_products_to_posts' );How the Code Works
- Database Query: This code uses WordPress’s global
$wpdbobject to directly update the database. It changes all posts with the typeproductto the typepost, effectively converting WooCommerce products into standard blog posts. - Action Hook: The function runs on the
inithook, so the conversion will happen when WordPress is initialised.
Step 2: Keeping Product Data as Post Meta
Once your products are converted to posts, you may want to retain some of the product-specific metadata, such as SKU, price, or stock status. This can be useful if you want to display this information within the post.
Here’s how you can retain product metadata and repurpose it in your new posts.
/*
* Snippet: How to Change Products to Posts in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1538
* Tested with WooCommerce 10.7.0
* "This function retains product meta data when converting to posts"
*/
function wcsuccess_preserve_product_meta_as_post_meta( $post_id, $post ) {
if ( 'post' === $post->post_type && has_term( '', 'product_cat', $post ) ) {
// Copy WooCommerce meta fields as post meta
$product_meta = get_post_meta( $post_id, '_sku', true ); // Get SKU
if ( !empty( $product_meta ) ) {
update_post_meta( $post_id, 'original_product_sku', $product_meta );
}
$price = get_post_meta( $post_id, '_price', true ); // Get product price
if ( !empty( $price ) ) {
update_post_meta( $post_id, 'original_product_price', $price );
}
}
}
add_action( 'save_post', 'wcsuccess_preserve_product_meta_as_post_meta', 10, 2 );How the Metadata Retention Works
- Meta Field Preservation: This function copies the SKU and price from the original product and saves them as post meta under new keys (
original_product_sku,original_product_price) so that the information can still be displayed within the converted post. - Repurposing Meta: You can then access this information on the front-end by calling these post meta fields in your post template.
Step 3: Displaying Product Information in Posts
If you want to display the preserved product information (like SKU or price) within the converted post, you can use the get_post_meta() function inside your post template or use a shortcode to display this information.
/*
* Snippet: How to Change Products to Posts in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1538
* Tested with WooCommerce 10.7.0
* "This shortcode displays original product sku and price in posts"
*/
function wcsuccess_display_product_info_in_post() {
global $post;
$original_sku = get_post_meta( $post->ID, 'original_product_sku', true );
$original_price = get_post_meta( $post->ID, 'original_product_price', true );
if ( !empty( $original_sku ) || !empty( $original_price ) ) {
return sprintf( 'SKU: %s | Price: %s', esc_html( $original_sku ), esc_html( $original_price ) );
}
return '';
}
add_shortcode( 'product_info', 'wcsuccess_display_product_info_in_post' );Using the Shortcode
Once the shortcode is added, you can insert it anywhere in your posts to display the original product’s SKU and price:
[product_info]This dynamically inserts the SKU and price for each post that was originally a WooCommerce product, helping to maintain the connection between products and blog content.
Best Use Cases for Converting Products to Posts
- Turn Discontinued Products into Articles: Keep valuable product information on your website as a blog post, providing detailed insights, reviews, or updates.
- SEO Opportunities: Improve search engine visibility by repurposing old products into informative blog posts, helping drive organic traffic.
- Content Restructuring: When changing your store’s structure or transitioning away from eCommerce, repurposing products into posts can keep your site’s content relevant and engaging.
Conclusion
Converting WooCommerce products into WordPress posts can provide many benefits, from repurposing old content to improving SEO and content organisation. With the provided custom code, you can easily switch products to posts, retain critical product data, and even display that information within the new posts.
As always, we recommend testing this on a staging environment before implementing it on a live site, and don’t forget to use a child theme to protect your customisations from theme updates. For more WooCommerce tips, explore our WooCommerce Visual Hooks Guide and wp-config generator.
I have been working with WordPress and WooCommerce since 2012 and have developed a deep knowledge of the content management system. Since 2012, I have developed several plugins and designed dozens of websites utilising different frameworks, CMS’s and programming languages. I am proficient in PHP, Python, Java, C, C++, R and JavaScript with limited experience in Go, Kotlin and Swift.
Educationally, I have a Master’s degree in cyber security a Bachelor’s (Hons, First Class) in Applied Research and a Graduate Certificate in Data Science. I’m currently undertaking PhD studies investigating IoT cybersecurity. I recently graduated with First Class Honours and Masters of Information Technology, receiving the Executive Dean’s Award for studies undertaken in the 2021 and 2022 academic years. I have worked in the information technology industry for the past 11 years primarily as a software/web developer specific to design, optimisation, network management and security. My research interests are in the areas of Internet of Things (IoT), 5G and Beyond Networks, information security for wireless networks and software development.
Stay In Touch

