Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save wpweb101/67cb975ae0f9bc8f4b37f4c479d60db2 to your computer and use it in GitHub Desktop.

Select an option

Save wpweb101/67cb975ae0f9bc8f4b37f4c479d60db2 to your computer and use it in GitHub Desktop.
WooCommerce Pdf Vouchers - Function to change {booking_date} shortcode date format
<?php
add_filter( 'woo_vou_pdf_template_replace_shortcodes', 'woo_vou_pdf_change_booking_date_shortcodes', 999, 6 );
function woo_vou_pdf_change_booking_date_shortcodes( $woo_vou_details, $orderid, $item_key, $items, $voucodes, $productid ){
// code to change booking date shortcode date format on voucher pdf
if( isset( $woo_vou_details['booking_date'] ) && !empty( $woo_vou_details['booking_date'] ) ){
$woo_vou_details['booking_date'] = date( 'Y-M-D', strtotime( $woo_vou_details['booking_date'] ) );
}
return $woo_vou_details;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment