Check if order is valid in checkout shortcode, closes #8829

This commit is contained in:
Claudio Sanches 2015-08-15 17:50:42 -03:00
parent c324c66acc
commit a9a6009b66
1 changed files with 7 additions and 3 deletions

View File

@ -42,7 +42,7 @@ class WC_Shortcode_Checkout {
$order_id = absint( $_GET['order'] );
$order = wc_get_order( $order_id );
if ( $order->has_status( 'pending' ) ) {
if ( $order && $order->has_status( 'pending' ) ) {
$wp->query_vars['order-pay'] = absint( $_GET['order'] );
} else {
$wp->query_vars['order-received'] = absint( $_GET['order'] );
@ -67,6 +67,8 @@ class WC_Shortcode_Checkout {
/**
* Show the pay page
*
* @param int $order_id
*/
private static function order_pay( $order_id ) {
@ -170,6 +172,8 @@ class WC_Shortcode_Checkout {
/**
* Show the thanks page
*
* @param int $order_id
*/
private static function order_received( $order_id = 0 ) {