Skip to content

Instantly share code, notes, and snippets.

@praveencs87
Created November 14, 2020 05:49
Show Gist options
  • Save praveencs87/c23b68855a7f94a1ed4b81b64ed84a7a to your computer and use it in GitHub Desktop.
Save praveencs87/c23b68855a7f94a1ed4b81b64ed84a7a to your computer and use it in GitHub Desktop.
Yith Delivery Date Filed Label Change based on Shipping Method - webinwordpress.com
<?php
//Chnage based on Shipping
if(!function_exists( 'ywcdd_change_label_datefield' ) ) {
add_filter( 'ywcdd_change_datepicker_label', 'ywcdd_change_label_datefield', 10 );
function ywcdd_change_label_datefield() {
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
if(isset($chosen_methods)) {
$chosen_shipping = $chosen_methods[0];
if ($chosen_shipping == 'local_pickup') {
return __( 'Local Pickup Date', 'yith-woocommerce-delivery-date' );
}
else {
return __( 'Delivery date', 'yith-woocommerce-delivery-date' );
}
} else {
return __( 'Delivery Date', 'yith-woocommerce-delivery-date' );
}
}
}
// Change Email Labels
add_filter( 'ywcdd_show_date_shipping_details', '__return_false' );
if( !function_exists( 'ywcdd_change_date_label')) {
add_filter( 'ywcdd_change_delivery_date_label', 'ywcdd_change_date_label' );
function ywcdd_change_date_label() {
return __( 'Delivery/Pickup Date', 'yith-woocommerce-delivery-date' );
}
}
//Yith Delivery Date Filed Label Change based on Shipping Method - webinwordpress.com
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment