MAI:
Hi Waqar,
on our page there is a possibility to buy a ticket for a sportscamp. We have a custom template to show all the info about the camp. Is it possible to take the data from the content template and pull it into the confirmation email that the customer gets, so they can see what they bought? Right now they only see the camp name and the price. Not the specific info with age, level, etc.
_________
WAQAR:
Hi,
I apologize for the delay in getting back on this as I had a busy queue after the weekend.
Just wanted to let you know that I'll be running some tests based on your requirement and will be able to share my findings with you, in next few hours.
Thank you for your patience.
regards,
Waqar
___________
WAQAR:
Hi,
Thank you for waiting.
I've performed some tests and research and I was able to include the content from a Toolset content template into the WooCommerce's "order completed" email, using the "woocommerce_email_before_order_table" hook from WooCommerce.
( ref: hidden link)
Example:
*custom code*
Note: You'll replace "123" with the post ID of the target "sportscamp" post and "456" with the ID of the target content template to use.
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.
Also, you'll find the information about the Toolset's "render_view_template" function here:
https://toolset.com/documentation/programmer-reference/views-api/#render_view_template
I couldn't find any WooCommerce hook to send a duplicate email to another user, so it would best to consult their official support team or community forums, for that part.
regards,
Waqar
_________________
MAI:
Hi Waqar,
That sounds good. Just to be sure: When I put in an ID for the specific sportscamp - will that only include this single camp then? Because I need the data to appear on the mail no matter what camp the customer buys. Do you know what I mean?
_______________
WAQAR:
Hi,
Thanks for writing back.
Yes, in my example code snippet, I just used a fixed sports camp post ID, to give you an idea. To use the sports camp post ID dynamically, it would depend on what connection/relationship you have with the purchased/ordered product and the sports camp post.
Can you please share some information about that and if admin access would help in getting clearer picture, you're welcome to share that too.
Note: Your next reply will be private and though no changes will be made on your website, please make a complete backup copy, before sharing the access details.
regards,
Waqar
__________________
MAI:
*sharing admin details
________________
WAQAR:
Thank you for sharing the admin access.
I understand that the first form to add a new camp is on the page "Welcome host" ( /welcome-host/ ).
And the second form to add a new product is on page "Welcome host – product info" ( /welcome-host-product-info/ ).
Since a post-relationship exists between these two post types, I'll assume, that you'd also like to link the posts created as a result of these forms in this post-relationship's association.
Using some extra custom code, it may be possible to create a "Product" post, programmatically, when the first form for the camp is submitted, but, before I could suggest the next steps, I'll need to clearly understand the role/need of the fields used in the second form for the product.
The "Price" needs to be saved with the product post, but the title of the camp post can be the same as the product post.
Is there any special reason for the fields like "Antal ledige pladser på campen", "Indtast dit registreringsnummer", and "Indtast dit kontonummer" to be saved with the product post and not the camp post?
_______________
MAI:
Hi Waqar,
I am so sorry for the late reply. I got hurt and had to have eye surgery so I was out for a few weeks.
You are right about all the things you write. The reason for the fields not being in the camp post is simply that it was not possible to create 1 post that contains all the information needed. Fields such as price, quantity (which is “Antal ledige pladser”) etc, that comes from the WooCommerce product was not possible to create in the same post form as the camp info. You guys helped me create the second post form so that we could get all the information we needed.
The reason that it was not possible was because we needed an actual product to appear in order to activate the purchase function on the site. And this was not possible with a normal post form as far as I remember.
Can you please let me know what you need to go to the next step from here? I am still just trying to get back to work, so please just fill me in.
My topic was closed so that is why I create the ticket like this.