Skip to content

Instantly share code, notes, and snippets.

@yiedpozi
Last active March 26, 2023 22:04
Show Gist options
  • Save yiedpozi/4e0bd78fa0304125d6d883c87658d93b to your computer and use it in GitHub Desktop.
Save yiedpozi/4e0bd78fa0304125d6d883c87658d93b to your computer and use it in GitHub Desktop.
Fix toyyibPay plugin - thank you page not showing order details
<?php
// Add this function in toyyibpay-for-woocommerce/index.php file
// Fix WooCommerce order key parameter that clashed with toyyibPay
add_filter( 'woocommerce_thankyou_order_key', function( $order_key ) {
if ( isset( $_GET['order_key'] ) && !empty( $_GET['order_key'] ) ) {
$order_key = wc_clean( wp_unslash( $_GET['order_key'] ) );
}
return $order_key;
} );
<?php
// Change $returnURL variable (line 306) in toyyibpay-for-woocommerce/src/toyyibpay.php
$returnURL = add_query_arg( 'order_key', $customer_order->get_order_key(), wc_get_endpoint_url( 'order-received', $order_id, wc_get_checkout_url() ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment