Add invoice title in Wildcards For Emails

March 25, 2021
randyabidin-com

Add a wildcard (something like %invoice_title%) for the invoice title. I just started using Sliced Invoices and two customer already didn’t recognize invoice number in the email subject and did pay attention to it.
Thanks for your consideration on this!

2 Comments. Leave new

Sliced Invoices
March 25, 2021 8:48 pm

It’s a good a idea, hopefully we can add that sometime in a future update.

Until then I just wanted to mention…. If you’re comfortable with code, there is a code snippet that shows a couple examples of how to create custom wildcards here: https://slicedinvoices.com/developers/code-snippets/ — search for the one labeled “Adding custom email wildcards”. (Invoice title is not one of the examples given, but with a little modification it probably would be easy to create.)

randyabidin-com
April 14, 2021 8:29 am

Wow Thanks!
I just saw that and modified the example filter and came up with the following that appears to work.

add_filter( ‘sliced_email_content_replace’, ‘sliced_email_wildcards_title’ );
function sliced_email_wildcards_title( $string ) {
$id = sliced_get_the_id();
$post_title = get_the_title( $id );
$return_title = str_replace( ‘%title%’, $post_title, $string );
return “$return_title”;
}

FYI: I don’t recall receiving an email that you responded to this feature request. I only came to this post to reply that I answered my question and you can remove this request.

Thanks again!
Randy

Leave a Reply

Your email address will not be published.