Home » WooCommerce: Show Published Date @ Single Product

WooCommerce: Show Published Date @ Single Product

by adminkys

Hello WooCommerce Customizers! Today we take a look at the WooCommerce Single Product Page and specifically at how to display the product/post published date. It might be useful to users in case you need to show how “new” a product is, or if you have specific needs. Enjoy 🙂

WooCommerce: Show Product Published Date
WooCommerce: Show Product Published Date

PHP Snippet: Show Product Published Date @ WooCommerce Single Product Page

/*
 * @snippet       WooCommerce: Show Product Published Date
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 5
 * @donate $9     https://www.tutoraspire.com
 */

add_action( 
 'woocommerce_single_product_summary', 'bloomer_echo_product_date', 25 );

function bloomer_echo_product_date() {
   if ( is_product() ) {
      echo the_date( '', 'Published on: ', '', false );
   }
}

// Change the date format: https://codex.wordpress.org/Function_Reference/the_date

You may also like