Set the time of day when scheduled gift cards are delivered, regardless of when the customer added them to the cart.
Note:
This is a Developer level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customizations. We are unable to provide support for customizations under our Support Policy.
Test custom code on a staging site before using it on your store. Add PHP to a custom plugin or a child theme’s functions.php file. If the file is already inside a PHP block, omit the opening PHP tag.
By default, a scheduled gift card is delivered around the time of day it was added to the cart. For example, a gift card added at 2:00 p.m. and scheduled for December 1 is delivered around 2:00 p.m. on December 1.
Use these filters to set the delivery time for scheduled gift cards. The time uses your store’s time zone. This example sets it to 9:30 a.m.; change the hour (0–23) and minute (0–59) to suit your store.
<?php
add_filter( 'woocommerce_gc_scheduled_delivery_hour', 'custom_gift_card_delivery_hour' );
add_filter( 'woocommerce_gc_scheduled_delivery_minute', 'custom_gift_card_delivery_minute' );
/**
* Set the scheduled delivery hour in the store's time zone.
*
* @return int Delivery hour, from 0 to 23.
*/
function custom_gift_card_delivery_hour() {
return 9;
}
/**
* Set the scheduled delivery minute.
*
* @return int Delivery minute, from 0 to 59.
*/
function custom_gift_card_delivery_minute() {
return 30;
}
Verify the change
↑ Back to topOn a staging site, purchase a gift card scheduled for a future date. Confirm its scheduled delivery time matches your chosen time in the store’s time zone, then check that the recipient receives it.
Questions and support
↑ Back to topSomething missing from this documentation? Still have questions and need assistance?
- If you have a question about a specific extension or theme you’d like to purchase, contact us to get answers.
- If you already purchased this product and need some assistance, get in touch with a Happiness Engineer via our support page and select this product’s name from the Product dropdown.