Created
August 9, 2021 01:28
Adds a new WooCommerce Twilio message variable for use with WooCommerce Delivery Slots when using WooCommerce Twilio SMS Notifications
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
<?php // only use if needed | |
/** | |
* Add a new WooCommerce Twilio message variable for use with WooCommerce Delivery Slots | |
* | |
* @param string $message the SMS message | |
* @param \WC_Order $order the order object | |
* @return string updated message | |
*/ | |
function sv_wc_twilio_sms_variable_replacement_jckwds_date( $message, $order ) { | |
// Adds the custom WooCommerce Delivery Slots date as a variable to be used | |
$jckwds_date = $order->get_meta( 'jckwds_date', true ); | |
$message = str_replace( '%jckwds_date%', $jckwds_date, $message ); | |
return $message; | |
} | |
add_filter( 'wc_twilio_sms_customer_sms_before_variable_replace', 'sv_wc_twilio_sms_variable_replacement_jckwds_date', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment