• Hello,

    I want to display the total price of the purchased product in the email body. Is there any shortcode for that? I tried with {order_total} but no luck.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,
    There isn’t a placeholder for that, you would have to create your own placeholder. See here for an example: https://www.ads-software.com/support/topic/missing-placeholders/#post-12108005

    Ben

    Thread Starter shakirahmed

    (@shakirahmed)

    Hey Ben, according to your given link I tried to add the below codes in my theme’s function.php file to show the total price in the customer processing order’s email body.

    add_filter( 'kadence_woomail_order_body_text', 'custom_function_for_billing_email', 10, 2 );
    function custom_function_for_order_total ( $text, $order ) {
    if ( is_a( $order, 'WC_Order' ) ) {
    $text = str_replace( '{order_total}',  $order->get_order_total(), $text );
    }
    return $text;
    }

    After adding this code to the function.php file, the whole text from the email body disappeared. I am not an expert in coding. Might be my code is wrong. Can you please help me with the right code?

    Thread Starter shakirahmed

    (@shakirahmed)

    No luck so far. @britner Can you help me, please?

    Hey @shakirahmed,

    I suggest getting a developer if your unfamiliar with writing custom code, this is not the kind of thing our plugin support can write/manage/support for you.

    Looking at what you posted you don’t have the function names matching up. In the filter you are calling: “custom_function_for_billing_email” but your actual function name is “custom_function_for_order_total”. Those have to match up.

    Then you are calling $order->get_order_total() and that isn’t a method of the order class. If you want the order total it’s $order->get_total()

    Ben

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Any way to show total order amount in email body?’ is closed to new replies.