Integrate Twilio for WooCommerce with WooFood

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'...

June 15, 2020 WPSlash

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

Commission-free ordering

Run restaurant orders on your own WordPress site

FoodMaster adds delivery, pickup, dine-in, POS, and kitchen tools — with zero per-order fees.

Get FoodMaster

Leave a Comment

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

×

🔥 ONE DAY ONLY OFFER 🔥

Upgrade FoodMaster Today

Normally your license is limited to 1 Website.

Today only, get a LIFETIME Unlimited Websites License for just:
$499

✔ Unlimited Client Websites
✔ Unlimited Personal Projects
✔ Future Updates Included
✔ Save Hundreds on Additional Licenses

Offer Ends In: