Created
January 11, 2023 10:09
-
-
Save rafsuntaskin/80f4b80a36c4bba2458934e609076da1 to your computer and use it in GitHub Desktop.
Workaround for JSON error on Sage theme with AR Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is a workaround to make AR page work with Sage theme JSON errors. | |
* | |
* Under Tickets > Settings > Attendee Registration | |
* -> Set Attendee Registration Slug to 'attendee-registration' | |
* -> Don't choose any page. | |
* -> Now create a Page with the shortcode [tribe_attendee_registration] and use the slug `attendee-registration-info` for that page. | |
* -> Then just copy and paste this code in your theme's functions.php file. | |
*/ | |
add_filter( 'woocommerce_get_checkout_url', 'rt_et_force_page_slug_manually', 60 ); | |
function rt_et_force_page_slug_manually( string $url ) { | |
// if url has tickets-provider in it, then we need to force the page slug | |
if ( strpos( $url, 'tickets_provider' ) !== false ) { | |
$force_page_slug = 'attendee-registration-info'; | |
// replace slug from url | |
$url = str_replace( 'attendee-registration', $force_page_slug, $url ); | |
} | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment