Support » Plugin: Woo Custom Emails » Include hooks or template file

  • Hello,
    thx for this awsome Plug-In!

    I have a problem with what I’m trying to to though.

    I created an order status for “has been shipped” and I’m using another plugin to include the tracking info into the mail that is send when an order is set to “has been shipped”

    The plugin uses the hook woocommerce_email_before_order_table to drop the info into the mail.

    Is there a way how I can either create this hook via short-code or use the existing template alltogether?

    Thx for your help

Viewing 7 replies - 1 through 7 (of 7 total)
  • I would like to know if I can add custom shortcodes also to include custom fields.

    Hi, this is howI created mine, hope this helps. Within woo-custom-emails/admin/class-wcemails-instance.php

    Within the function convert_template I added:

    $this->find[]    = '{order_items}';
     $this->replace[] = $this->get_the_order_items();

    Then under function get_the_order_items I added:

    function get_the_order_items() {
    			if ( $items = $this->object->get_items() ) {
    				foreach ( $items as $item ) {
    					echo "<br>".$item['name']." x ".$item['qty']." "; 
    			return ob_get_clean();

    So now I can add {order_items} to the email template which will list the order items & quantity like this:
    Wet Paper Towel x 10
    Soggey Weatbix x 6

    I found this place useful to find the get function ie get_the_order_items().

    • This reply was modified 3 years, 1 month ago by nicko619.
    • This reply was modified 3 years, 1 month ago by nicko619.
    Plugin Author Mehul Kaklotar



    You can use this filters wcemails_find_placeholders & wcemails_replace_placeholders to add your content or replace the content in current placeholders.

    Here is the line where you can see the arguments Find Array, Replace Array, Order Object ->

    Hello Mehul Kaklotar,

    Can you please give an example on how we can implement get_formatted_billing_address as shortcode?

    • This reply was modified 2 years, 11 months ago by Antonis1982.


    is it possible to only have the email trigger manually?

    meaning that it wont fire on any order status change, but rather when selected in the order actions meta box.

    also, i have created my own custom order action, is it possible to hook the email send to that?


    • This reply was modified 2 years, 11 months ago by kookookjew.
    Plugin Author Mehul Kaklotar



    add_filter( 'wcemails_find_placeholders', 'wcemails_your_theme_find_formatted_billing_address' );
    function wcemails_your_theme_find_formatted_billing_address( $find ) {
    	$find[] = '{formatted_billing_address}';
    	return $find;
    add_filter( 'wcemails_replace_placeholders', 'wcemails_your_theme_replace_formatted_billing_address', 10, 2 );
    function wcemails_your_theme_replace_formatted_billing_address( $replace, $order ) {
    	$formatted_billing_address = $order->get_formatted_billing_address();
    	$replace[] = $formatted_billing_address;
    	return $replace;
    Plugin Author Mehul Kaklotar



    That is a good suggestion to include in the release. I will try to add this feature in to next release.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Include hooks or template file’ is closed to new replies.