Skip Navigation

[Resolved] Add details to email code

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by maiS 3 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1987761
Skærmbillede 2021-03-15 kl. 17.01.26.png

Hi,

You guys helped me pulling extra data into the order processing mail and it looks like this:

add_action( 'woocommerce_email_after_order_table', 'custom_add_content_specific_email', 20, 4 );
function custom_add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
if ( ($email->id == 'customer_on_hold_order') || ($email->id == 'new_order') ) {
// ID of the CT to get the content from
$target_ct = 1288;
ob_start();
// cycle through each product in the order
foreach ($order->get_items() as $item_id => $item_values) {
// get the product's ID
$product_id = $item_values['product_id'];
// get the related camp's ID
$related_camp_id = toolset_get_related_post( $product_id, 'camp-product' );
// get the content template's output with the related camp post set as the source
echo render_view_template( $target_ct, $related_camp_id );
}
echo ob_get_clean();
}
}

Is it possible to add some details like a title called "Praktisk info" above the data? And also change "Camp name" to "Camp navn"?

You can see the screenshot for explanation

Thanks so much

#1987929

hi, did this go through? I can not see it on my site with the ticket overview?

#1988481

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Mai,

Thank you for contacting us and I'd be happy to assist.

That content in the email is coming from the content template named "Test CT to show camp details in email".
( yourwebsite.com/wp-admin/admin.php?page=ct-editor&ct_id=1288 )

You can change the text label for the existing fields or add a new one in there.

regards,
Waqar

#1992387

Thanks Waqar, I found it and i think i got it. Will test later

#1993133

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

You're very welcome and please let me know if you have any follow-up questions.

For a new question or concern, please start a new ticket.

#1995333

My issue is resolved now. Thank you!

#1998911

Hi Waqar,
So i tested the email and now all the data from the test template is gone. Can you please check and see what I did wrong? Thanks

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.