How to add my registrations on my account page
Any user when visiting your website may want to check all the events for which he had registered. In such a case, A page created prior to the shortcode [my_registrations] allows him to view all his registrations.
However, What if you want to display this My registration page on the My Account section of the website. In this case, We have provided the following snippet which when added to the functions.php file of a child theme, would set up My Registration page on the My Account section.
Note: Please ensure, Sell ticket, Registration addons are active on the website, post which the following shortcode needs to be added to the functions.php file of the child theme.
<?php // ------------------ // 1. Register new endpoint to use for My Account page // Note: Resave Permalinks or it will give 404 error function wpem_add_my_registrations_endpoint() { add_rewrite_endpoint( 'my-registrations', EP_ROOT | EP_PAGES ); } add_action( 'init', 'wpem_add_my_registrations_endpoint' ); // ------------------ // 2. Add new query var function wpem_my_registrations_query_vars( $vars ) { $vars[] = 'my-registrations'; return $vars; } add_filter( 'query_vars', 'wpem_my_registrations_query_vars', 0 ); // ------------------ // 3. Insert the new endpoint into the My Account menu function wpem_add_my_registrations_link_my_account( $items ) { $items['my-registrations'] = 'My Registrations'; return $items; } add_filter( 'woocommerce_account_menu_items', 'wpem_add_my_registrations_link_my_account' ); // ------------------ // 4. Add content to the new endpoint function wpem_my_registrations_content() { echo ' My Registrations '; echo do_shortcode( '[my_registrations]' ); } add_action( 'woocommerce_account_my-registrations_endpoint', 'wpem_my_registrations_content'); ?>