• Resolved topmostwp

    (@topmostwp)


    Hello, is there a way to add a new shortcode/placeholder? Like i want to add a new placeholder for customer email {customer_email}. Thanks ben

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Ben Ritner – Kadence WP

    (@britner)

    Hey,
    You can use a code like this:

    add_filter( 'kadence_woomail_order_body_text', 'custom_email_placeholder', 15, 5 );
    function custom_email_placeholder( $body_text, $order, $sent_to_admin, $plain_text, $email ) {
    if ( $order ) {
    $body_text = str_replace( '{customer_email}', $order->get_billing_email(), $body_text );
    }
    return $body_text;
    }
    Thread Starter topmostwp

    (@topmostwp)

    Hi Ben,

    I added the code to function.php and when I tried to add the {customer_email} shortcode. It doesnt work.

    Plugin Contributor Ben Ritner – Kadence WP

    (@britner)

    Which email are you wanting to show this in?

    Ben

    Thread Starter topmostwp

    (@topmostwp)

    Hi ben, i want to show this in customer new account email

    Plugin Contributor Ben Ritner – Kadence WP

    (@britner)

    ok, thats a little different then order emails. You would need to use code like this:

    add_filter( 'kadence_woomail_no_order_body_text', 'custom_email_placeholder_no_order', 15, 2 );
    function custom_email_placeholder_no_order( $body_text, $email ) {
    if ( is_a( $email->object, 'WP_User' ) ) {
    $body_text = str_replace( '{customer_email}', $email->object->user_email, $body_text );
    }
    return $body_text;
    Thread Starter topmostwp

    (@topmostwp)

    Thank you Ben it’s now working! Thanks for the great plugin

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Add new shortcode’ is closed to new replies.