Skip to main content
All CollectionsIntegrationsWooCommerce
Blacklist specific delivery days in WooCommerce
Blacklist specific delivery days in WooCommerce

Set specific dates to be blocked in the checkout

Rasmus Hallgren avatar
Written by Rasmus Hallgren
Updated over 2 years ago

Do you have specific days or dates that deviate from the regular delivery schedule? Now you can blacklist those days that's so that your customers can book a delivery. This is usually applicable during special occasions such as Christmas or Summer holidays when working hours are limited.

Update the functions.php in Wordpress admin and add the following script. Don't forget to change the dates in the array to reflect the days you wish to blacklist.

This will remove the blacklisted delivery days from the checkout page, even if Gordon can deliver on the selected days.

<?php

/**
* @snippet WooCommerce - Blacklist dates for Gordon Delivery
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 4.9.0
*/
function redlight_gordon_blacklist_dates( $date_array ) {
//An Array with dates in YYYY-MM-DD format
$date_array = array(
"2021-05-11",
"2021-05-25",
"2021-06-15",
);

return $date_array;
}
add_filter('redlight_gd_delivery_window_blacklist', 'redlight_gordon_blacklist_dates', 10 );
Did this answer your question?