Add a template variable for order notifications in WooCommerce Twilio SMS Notifications. Set up the store’s SMS settings first. Test custom replacements with an unsaved example order on a test site before using them in a live template.
Note:
This is a developer-level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customization work. We are unable to provide support for customization under our Support Policy.
Add a template variable
↑ Back to topAdd this example to a site-specific plugin. In an admin or customer order message, insert %store_support_hours% where you want your support hours to appear. Change the example text to match your store.
add_filter( 'wc_twilio_sms_message_replacements', function ( $replacements ) {
$replacements['%store_support_hours%'] = 'Mon–Fri, 9 am–5 pm Eastern';
return $replacements;
} );
Verify that the placeholder is replaced in an order message. The settings screen’s Send Test SMS sends plain text without order variables. If the placeholder remains in the message, verify the plugin is active and check that the template has both percent signs. Leave message URLs in full if you use the extension’s built-in shortening settings.
Filters for automated customer order messages
↑ Back to topwc_twilio_sms_customer_sms_before_variable_replacereceives the template text and aWC_Orderbefore the plugin replaces placeholders.wc_twilio_sms_customer_sms_after_variable_replacereceives the rendered message and theWC_Orderafter replacement and before URL shortening.wc_twilio_sms_customer_phonereceives the billing phone number and theWC_Order. It controls the recipient for the automated customer message.
The built-in %order_id% uses the displayed order number, including custom order numbers supplied through WooCommerce. Use %billing_first% for the billing first name.
URL rewriting filter
↑ Back to topwc_twilio_sms_shorten_url receives the provider’s result, the original URL, and the configured provider ID. When a built-in provider is selected, the filter runs after that provider’s result. Turning off Shorten URLs bypasses the provider and this filter.
Questions and support
↑ Back to topQuestions and support
↑ Back to topSomething missing from this documentation? Still have questions and need assistance?
- If you have a question about a specific extension or theme you’d like to purchase, contact us to get answers.
- If you already purchased this product and need some assistance, get in touch with a Happiness Engineer via our support page and select this product’s name from the Product dropdown.