Created
October 15, 2018 14:45
-
-
Save btribouillet/104865353f76185e4f9776ea250c0ac7 to your computer and use it in GitHub Desktop.
Feature request : apply_filters on delivery date & delivery time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Update order delivery time with value from location cookie | |
* | |
* @param $value | |
* @return mixed | |
*/ | |
function update_order_delivery_time( $value ) { | |
$location = Vmm_Helpers::get_location(); | |
if( isset( $location['timeslot'] ) ) { | |
$value = $location['timeslot']; | |
} | |
return $value; | |
} | |
add_action( 'iconic_wds_update_order_delivery_time', 'update_order_delivery_time' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper: Update order meta on successful checkout submission | |
* | |
* @param int $order_id | |
*/ | |
function update_order_meta( $order_id ) { | |
$timeslot = false; | |
$posted_date = apply_filters( 'iconic_wds_update_order_delivery_date', filter_input( INPUT_POST, 'jckwds-delivery-date', FILTER_SANITIZE_STRING ) ); | |
$posted_date_ymd = apply_filters( 'iconic_wds_update_order_delivery_date_ymd', filter_input( INPUT_POST, 'jckwds-delivery-date-ymd', FILTER_SANITIZE_STRING ) ); | |
$posted_time = apply_filters( 'iconic_wds_update_order_delivery_time', filter_input( INPUT_POST, 'jckwds-delivery-time', FILTER_SANITIZE_STRING ) ); | |
$date_changed = (int) filter_input( INPUT_POST, 'jckwds-date-changed', FILTER_SANITIZE_NUMBER_INT ); | |
if ( empty( $posted_date ) || empty( $posted_date_ymd ) ) { | |
return; | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment