Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliebugmtl/d6ee5da5a5b2628b40b53287144abc84 to your computer and use it in GitHub Desktop.
Save juliebugmtl/d6ee5da5a5b2628b40b53287144abc84 to your computer and use it in GitHub Desktop.
Adds a new WooCommerce Twilio message variable for use with WooCommerce Delivery Slots when using WooCommerce Twilio SMS Notifications
<?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