Waiting for author
Overview of the issue
When you are using the Event Tickets Plus plugin to create a new event and add tickets to it, the tickets section does not appear on the translated event page.
Workaround
Please, before proceeding, make a full backup of your site:
- Add the following snippet to WPML → Settings → Custom XML Configuration:
<wpml-config> <custom-fields> <custom-field action="copy">_ticket_end_date</custom-field> <custom-field action="copy">_ticket_start_date</custom-field> <custom-field action="copy">_tribe_ticket_capacity</custom-field> <custom-field action="copy">_tribe_ticket_show_description</custom-field> <custom-field action="copy">_tribe_ticket_version</custom-field> <custom-field action="copy">_tribe_tickets_ar_iac</custom-field> <custom-field action="copy">_tribe_tickets_meta</custom-field> <custom-field action="copy-once">_tribe_wooticket_for_event</custom-field> </custom-fields> </wpml-config>
- Add the following code to the functions.php file:
//WPML Workaround add_action( 'save_post', 'wpmldp_update_tribe_wooticket_for_event_meta', 999,3 ); function wpmldp_update_tribe_wooticket_for_event_meta( $post_id, $post, $update ) { // Only set for post_type = product if ( 'product' !== $post->post_type ) { return; } //Check if WPML and THe Events Calendar are enabled if (class_exists('SitePress')) { //Get the current ID on "_tribe_wooticket_for_event" meta $current_wooticket_id = get_post_meta($post_id, '_tribe_wooticket_for_event'); if ( $current_wooticket_id ) { //Get Post Language $wpml_post_language_details = apply_filters( 'wpml_post_language_details', NULL, $post_id ) ; $wpml_current_language = $wpml_post_language_details['language_code']; //Check if there is a translation for the $current_wooticket_id. If not, returns the original ID $translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'tribe_events', FALSE, $wpml_current_language); //Update post meta with the translated ID if ($translated_wooticket_id) { update_post_meta( $post_id, '_tribe_wooticket_for_event', $translated_wooticket_id ); } } } return; }
- Create the event, and add tickets to it.
- Translate the event.
- Go to Products → All Products and edit the ticket.
- Do a small modification on the ticket and save.
- Translate the ticket. Keep in mind that if the event already exists, you just need to translate it before translating the ticket. If both are already translated, do a small modification on the original ticket, then update the translation.
If you are using The Events Calendar plugin, you will need to change this line:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'page', FALSE, $wpml_current_language);
To:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'tribe_events', FALSE, $wpml_current_language);
Next steps to resolve this issue
Event Tickets Plus and WPML are not fully compatible yet, but we’d like to work collaboratively with The Events Calendar team to finalize this. If this plugin’s compatibility with WPML is important to you, please let The Events Calendar team know via their public support forum, or private support channels and we can try to push this forward together.
Hello team WPML! I’m in a bit of a problem spot here with this very issue with Tickets. Since we are in Canada we are trying to offer the tickets in both French and English at https://mhfa.studio/evenements/.
I tried following the procedure but once I go to add the Events Calendar snippet I get a crash…
Your help would be super appreciated!
Hello Alex,
we will help you investigate your case but first, you need to open a ticket on our support forum: https://wpml.org/forums/forum/english-support/ Please log into your WPML account and click on “Report a new issue”. Thank you.
Hello,
This code is for the those who use Woocommerce.
What if we do not use Woocommerce but still want to show the tickets section on the translated event page? Any solutions?
Thanks.
Hello Romain,
This workaround should work for you as well. As it has lost its formatting, I just edited the page, could you please try it again?
If this does not work, please open a ticket in our support forum. Don’t hesitate to contact the author as well as he may be able to help you for your specific case.
Regards,
Andrés
Hi
Is this workaround still valid?
I have followed all the steps but the tickets still don’t appear on the translated page.
Hello there,
Yes, this workaround still should be valid. If it does not work for you, please open a chat in our support forum and don’t hesitate to contact the author at the same time.
Regards
Dear WPML Team,
the workaround seems to work in general, but in the translation the price and also the ticket capacity is not taken over. The price is then simply 0€.
I have now manually adjusted the translated product again.
Is there another solution here?
Many greetings,
Chris
Hello Chris,
I’m afraid we are not aware of this situation. Could you please open a chat in our forum so we can investigate it?
Thank you for your help.
Hi, we have this applied and work well with the Event tickets 5.7.1, Event Tickets plus 5.8.0, Event calendar 6.2.9 and Events calendar pro 6.2.4.
Wordpress 6.4..
With the updated versions of the Events tickets and calendar this not work. Do we can get a tip to update this that work with the last version of Tribe products?
thanks in advaced for the help
Best regards
Hello there,
It seems that something should have changed and our team will need to investigate it.
Could you please open a chat in our assistance channel so we can give it a look?
Thank you for your help.
Andrés