Simplify: Update order_contains_subscription()

To use Subscriptions 2.0 methods to avoid deprecated notices and move
use of old methods to WC_Addons_Gateway_Simplify_Commerce_Deprecated
This commit is contained in:
Brent Shepherd 2015-07-21 17:52:58 -07:00
parent 73999c5daf
commit e6ccf437e9
2 changed files with 11 additions and 1 deletions

View File

@ -149,4 +149,14 @@ class WC_Addons_Gateway_Simplify_Commerce_Deprecated extends WC_Addons_Gateway_S
return $order_meta_query;
}
/**
* Check if order contains subscriptions.
*
* @param int $order_id
* @return bool
*/
protected function order_contains_subscription( $order_id ) {
return class_exists( 'WC_Subscriptions_Order' ) && ( WC_Subscriptions_Order::order_contains_subscription( $order_id ) || WC_Subscriptions_Renewal_Order::is_renewal( $order_id ) );
}
}

View File

@ -65,7 +65,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
* @return bool
*/
protected function order_contains_subscription( $order_id ) {
return class_exists( 'WC_Subscriptions_Order' ) && ( WC_Subscriptions_Order::order_contains_subscription( $order_id ) || WC_Subscriptions_Renewal_Order::is_renewal( $order_id ) );
return function_exists( 'wcs_order_contains_subscription' ) && ( wcs_order_contains_subscription( $order_id ) || wcs_order_contains_renewal( $order_id ) );
}
/**