Set the Expiration Date to a fixed value

Gift Card expiration dates are available only in the PW Gift Cards Pro version.

To set the Expiration Date to a fixed value, follow these steps:

1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a Snippet with the following code:

Note: You can optionally add this to your functions.php if you’re more familiar with that process instead of using Code Snippets.

function custom_pwgc_generated_expiration_date( $expiration_date, $gift_card, $order_item_id, $credit_amount, $product ) {
	$expiration_date = '2023-12-31';

	return $expiration_date;
}
add_filter( 'pwgc_generated_expiration_date', 'custom_pwgc_generated_expiration_date', 10, 5 );
Change 2023-12-31 to your desired expiration date.

You can set $expiration_date to any valid string that strtotime() can parse. For example:

End of the current calendar year:
$expiration_date = date( 'Y' ) . '-12-31';
Next Saturday:
$expiration_date = 'next Saturday';
Skip to content