[Resolved] Email to post author

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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 1 month, 1 week ago.

Assigned support staff: Luo Yang.

Author
Posts
#1139514

Hi Luo,

I've the last question on my process.
If you remeber I built a booking process from an accommodation custom post type.

I used CRED to set the price of a product, and clicking on the button the product is added to the cart.

Everything works very god.

My problem now is only the last email, when the order is complete. By default woocomeerce send the email as set in the woocommerce email setting.

But I need to send the email to the author of the custom post accommodation.

How can I do?

#1140175

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hi,

I assume we are talking about a Toolset post form for creating "booking" post, as you can see this "order is complete" email is sent by Woocommerce plugin, so there isn't such a built-in feature within Toolset form plugin, it needs custom codes,
Here are my suggestion, you can try with filter hook "woocommerce_email_recipient_new_order", see similar thread:
hidden link

More help:
https://docs.woocommerce.com/wc-apidocs/source-class-WC_Email.html#351

Is there any relationship between post type "accommodation" and "booking", if there isn't, I suggest you setup one- post type relationship between them, then in the "order completed" email , you can get the "booking" post ID as this:
https://toolset.com/forums/topic/how-add-the-meta-also-to-the-woocommerce-order/#post-1118111

Then get "accommodation" post ID with function toolset_get_related_post()
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post