How To Change The Delivery Slots Labels

Let’s consider you run a flower shop and you want your customers to collect the flowers they ordered online, rather than have them delivered. 

While placing an order, you also want them to select the collection date and time slot for when they can visit your shop.

WooCommerce Delivery Slots is the perfect plugin for this setup. However, there is one tiny problem; the labels at checkout all say “Delivery”.

Standard delivery slot messaging

We need to change the wording to let the customers know that we are asking for collection details, rather than delivery details. 

We can change these field labels using a handy filter built into WooCommerce Delivery Slots, callediconic_wds_labels.

You will need to add this code snippet to the functions.php of your child theme:

/** 
 * Replace WooCommerce Delivery Slots labels. 
 * 
 * @param array $labels An array of labels.
 * @param WC_Order $order The WooCommerce order object.
 *                        
 * @return array
 */
function iconic_modify_delivery_slots_label( $labels, $order ) {
	$labels['details']           = 'Collection Information';
	$labels['date']              = 'Collection Date';
	$labels['select_date']       = 'Select a collection date';
	$labels['choose_date']       = 'Please choose a date for your collection';
	$labels['select_date_first'] = 'Please choose a date for your collection';
	$labels['choose_time_slot']  = 'Please choose a time slot for your collection';

	return $labels;
}

add_filter( 'iconic_wds_labels', 'iconic_modify_delivery_slots_label', 10, 2 );

The date and time slot labels will now look like this at checkout:

Custom messaging after using snippet

As you can see, the labels now clearly reflect that the date and time slots are for collection, rather than delivery. 

This is just one example, you can use the same code snippet to change the labels as per your requirement.

Which Labels Can I modify?

The iconic_wds_labels filter looks like this, which means you can modify any of these labels:

$labels = apply_filters( 'iconic_wds_labels', array(
	'details'           => __( 'Delivery Details', 'jckwds' ),
	'date'              => __( 'Delivery Date', 'jckwds' ),
	'select_date'       => __( 'Select a delivery date', 'jckwds' ),
	'choose_date'       => __( 'Please choose a date for your delivery.', 'jckwds' ),
	'select_date_first' => __( 'Please select a date first...', 'jckwds' ),
	'time_slot'         => __( 'Time Slot', 'jckwds' ),
	'choose_time_slot'  => __( 'Please choose a time slot for your delivery.', 'jckwds' ),
	'select_time_slot'  => __( 'Please select a time slot...', 'jckwds' ),
	'no_time_slots'     => __( 'Sorry, no slots available...', 'jckwds' ),
), $order );

WooCommerce Delivery Slots

Choose a delivery date and time for each order. Add a limit to the number of allowed reservations, restrict time slots to specific delivery methods, and so much more.

Was this helpful?

Please let us know if this article was useful. It is the best way to ensure our documentation is as helpful as possible.