Check if order is valid in checkout shortcode, closes #8829
This commit is contained in:
parent
c324c66acc
commit
a9a6009b66
|
@ -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 ) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue