Hi,
WC is using endpoints in checkout since V 2.1 - so i have a little problem to show customers a single "thankyou" page.
Actually the customer get back to the "checkout-page" and get information about payment ( Bacs ) from thankyou.php in content area.
What i need, is a new single page ( different style as checkout-page ) with the content from the thankyou.php. The Site are still created und designed well - used a permalink "thanks".
...i made this working with adding the following line:
$return_url = str_replace( 'checkout', 'thanks', $return_url );
on -> abstract-wc-payment-gateway.php | starts at line 59
public function get_return_url( $order = '' ) {
if ( $order ) {
$return_url = $order->get_checkout_order_received_url();
$return_url = str_replace( 'checkout', 'thanks', $return_url );
} else {
$return_url = wc_get_endpoint_url( 'order-received', '', get_permalink( wc_get_page_id( 'checkout' ) ) );
}
if ( is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes' ) {
$return_url = str_replace( 'http:', 'https:', $return_url );
}
return apply_filters( 'woocommerce_get_return_url', $return_url );
}
the new "thanks" site contains the same shortcode as the checkout page
[woocommerce_checkout]
It's still working, but without print the BACS or payment-details like cheque, C.O.D service...
The following line in thankyou.php | line 62 doesn't work on the new single site I've created.
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ) ;?>
Anybody there, who can help me with this?
Arnav Joy answers:
try this
<?php global $woocommerce; global $order; ?>
above this line
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ) ;?>
flipmode85 comments:
Hi,
doesn't work, template crash!
Arnav Joy comments:
try this
<?php $order_id = isset($_GET['order_id']) && (int) $_GET['order_id'] ? (int) $_GET['order_id'] : ''; $order = new WC_Order( $order_id );?>
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ) ;?>
flipmode85 comments:
same thing - template crashes, nothing get displayed.
the order ID are still available, not sure if this is really the problem. ( See attached screenshot I've made, after testing my own code )