Skip to content

Instantly share code, notes, and snippets.

@rafsuntaskin
Created January 11, 2023 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafsuntaskin/80f4b80a36c4bba2458934e609076da1 to your computer and use it in GitHub Desktop.
Save rafsuntaskin/80f4b80a36c4bba2458934e609076da1 to your computer and use it in GitHub Desktop.
Workaround for JSON error on Sage theme with AR Page
<?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