Use these snippets to customize the appearance and functionality of WooCommerce Gift Cards.
To use a PHP snippet, download the linked file and activate it as you would with any other plugin. Alternatively, copy the contained code into your child theme’s functions.php file.
Note: We are unable to provide support for customizations under our Support Policy. If you need to customize a snippet, or extend its functionality, seek assistance from a qualified WordPress/WooCommerce Developer. We highly recommend Codeable, or a Certified WooExpert.
Scheduled Gift Cards are delivered around the same time as the time they were added to the cart. For example, a gift card purchased on November 15, 14:00, and scheduled to be delivered on December 1, will be delivered on December 1st around 14.00.
Use the following snippet to set a custom time (hour, minute) for delivering all gift cards scheduled for delivery on a given date:
Use the following snippet:
If needed, you can use the existing coupon code form input to apply gift card codes, as well. This functionality is available as a free feature plugin.
The delivery date field of the datepicker is set to Now by default. To prevent customers from choosing a custom delivery date, use this snippet.
Use the following snippet to prevent customers from applying coupons when using gift cards to pay for an order:
Use the following snippet to display the remaining balance of any applied gift cards on the cart/checkout page:
To set a specific expiration date for a gift card, use the following snippet:
Before using this snippet, it is necessary to replace the values in
$base_datetime->setDate( '2021', '10', '10' ); with the custom expiration year/month/date you want to set.
To render the Gift Cards tab on a custom My Account page, use the following shortcode: