Skip to content

Instantly share code, notes, and snippets.

@rafsuntaskin
Created July 6, 2022 16:34
Show Gist options
  • Save rafsuntaskin/6437a68a46f9f81d1467bd9a09695900 to your computer and use it in GitHub Desktop.
Save rafsuntaskin/6437a68a46f9f81d1467bd9a09695900 to your computer and use it in GitHub Desktop.
Fix Checkout URL for Failed Order re-payment
<?php
// patch for Ticket# GTRIA-802
//remove the original filter
add_action( 'wp', 'rt_et_remove_tribe_filter', 99 );
function rt_et_remove_tribe_filter() {
$woo_cart = tribe( 'tickets-plus.commerce.woo.cart' );
remove_filter( 'woocommerce_get_checkout_url', [
$woo_cart,
'maybe_filter_checkout_url_to_attendee_registration'
], 50 );
add_filter( 'woocommerce_get_checkout_url', 'rt_maybe_filter_checkout_url_to_attendee_registration_without_provider', 55, 1 );
}
function rt_maybe_filter_checkout_url_to_attendee_registration_without_provider( $checkout_url ) {
if ( is_wc_endpoint_url( 'order-pay' ) || is_wc_endpoint_url( 'order-received' ) ) {
return $checkout_url;
}
$woo_cart = tribe( 'tickets-plus.commerce.woo.cart' );
return $woo_cart->maybe_filter_checkout_url_to_attendee_registration( $checkout_url );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment