Hello there, I am trying to bring in a custom field produced by the Preorder Plugin for Woocommerce by Bright Plugins into a product page. I can access the field through the “Meta (Custom Field)” dynamic field, but what I get is an ugly 2021-04-01 00:00:00 returned and no way to format it. I’ve tried adding format="F j, Y" to the syntax, but it doesn’t seem to work. Is this date format feature only available on certain fields?
As an alternative, I’ve created this custom shortcode in my functions.php, but for some reason it doesn’t seem to be working. Any ideas why?
//This is a custom shortcode to return a formatted version of the Preorder date
function print_formatted_preorder_date() {
$preorderdate = strtotime(get_post_meta($product->get_id(), '_pre_order_date', true));
print date_format($preorderdate, 'F j, Y');
}
add_shortcode('preorder_date', 'print_formatted_preorder_date');