WPSlash

Integrate Twilio for WooCommerce with WooFood

Monday June 15, 2020

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 .

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 );

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Articles

Restaurants Tutorials

The Cheapest Food Delivery App for Restaurants Isn’t an App at All — It’s WooFood

When restaurant owners start looking for the cheapest food delivery app, they quickly discover a frustrating truth: most “cheap” delivery platforms aren’t cheap at all. They either take commissions, charge high monthly fees, lock you into their payment processors, or limit how much control you have over your own customer base. But what if the […]
December 1, 2025
Restaurants WooFood

Why “Free” GloriaFood Might Not Be The Best Long-Term Bet For Your Restaurant

When you’re building an online ordering system for your restaurant, it’s tempting to go for a “free” solution. That’s exactly what GloriaFood offers: a ready-to-go, easy-to-install WordPress plugin for online ordering, delivery, and reservations with no setup fees or commissions But “free” doesn’t always mean “best,” especially when you’re serious about owning your brand, your […]
December 1, 2025
Tutorials WooCommerce

How to Choose the Best Food Ordering System for Your Restaurant (And Why WooFood is the Ultimate Solution)

If you’re running a restaurant, café, or fast-food business in today’s digital age, offering online food ordering is no longer optional — it’s essential. Customers expect the convenience of browsing your menu, customizing their orders, and checking out seamlessly from their phone or computer. But with so many plugins and systems available, how do you choose the right […]
April 21, 2025