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

@ -39,10 +39,10 @@ class WC_Shortcode_Checkout {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.1', '"order" is no longer used to pass an order ID. Use the order-pay or order-received endpoint instead.' );
// Get the order to work out what we are showing
$order_id = absint( $_GET['order'] );
$order = wc_get_order( $order_id );
$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 ) {