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 WooCommerce: Show Product Published Date

WooCommerce Snippet: Show Product Published Date


/**
 * @snippet       WooCommerce: Show Product Published Date
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=19936
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 3.4.2
 */

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

function bloomer_echo_product_date() {
if ( is_product() ) {
echo the_date('', '<span class="date_published">Published on: ', '</span>', false);
}
}

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

Share:

Leave a Reply