WPSlash Licences

Integrate Twilio for WooCommerce with WooFood

Integrate Twilio for WooCommerce with WooFood – code snippet guide from WPSlash
Published
Updated
Reading time
1 minutes
Written by
WPSlash team

Here is small code snippet to be able to use WooFood custom variables like Order Type (Delivery or Pickup), Date To Deliver and Time To Deliver .

Code
function wpslash_woofood_twilio_woocommerce_custom_variables( $message, $order ) {

        if ( ! class_exists( 'SV_WC_Order_Compatibility' ) ) {
                return $message;
        }

        $woofood_order_type     = woofood_get_order_type_by_key(SV_WC_Order_Compatibility::get_meta( $order, 'woofood_order_type' ));
	$woofood_date_to_deliver = SV_WC_Order_Compatibility::get_meta( $order, 'woofood_date_to_deliver' );
	$woofood_time_to_deliver = SV_WC_Order_Compatibility::get_meta( $order, 'woofood_time_to_deliver' );


        $message = str_replace( '%order_type%', $woofood_order_type, $message );
        $message = str_replace( '%date_to_deliver%', $woofood_date_to_deliver, $message );
        $message = str_replace( '%time_to_deliver%', $woofood_time_to_deliver, $message );

    

        return $message;
}
add_filter( 'wc_twilio_sms_customer_sms_before_variable_replace', 'wpslash_woofood_twilio_woocommerce_custom_variables', 10, 2 );
All guides

FoodMaster (formerly WooFood)12 min read

Best Store Address Setup for Pickup

Compare single-address, multi-location, and directions-first pickup setups to reduce wrong-door visits and simplify checkout.

The plugins these guides are about

FoodMaster for restaurants, courier vouchers for the Greek market, marketplace sync and store tools, all for WooCommerce.

Browse plugins30-day money-back on every plugin