mirror of
https://github.com/pronamic/woocommerce-subscriptions.git
synced 2025-10-12 12:22:56 +00:00
2.2.7
This commit is contained in:

committed by
Remco Tolsma

parent
5e536ec717
commit
b99eba2f79
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
*/
|
||||
function wcs_order_contains_switch( $order ) {
|
||||
|
||||
if ( ! is_object( $order ) ) {
|
||||
if ( ! is_a( $order, 'WC_Abstract_Order' ) ) {
|
||||
$order = wc_get_order( $order );
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ function wcs_order_contains_switch( $order ) {
|
||||
|
||||
} else {
|
||||
|
||||
$subscription_ids = wcs_get_objects_property( $order, 'subscription_switch', 'multiple' );
|
||||
$switched_subscriptions = wcs_get_subscriptions_for_switch_order( $order );
|
||||
|
||||
if ( ! empty( $subscription_ids ) ) {
|
||||
if ( ! empty( $switched_subscriptions ) ) {
|
||||
$is_switch_order = true;
|
||||
} else {
|
||||
$is_switch_order = false;
|
||||
@@ -51,7 +51,7 @@ function wcs_order_contains_switch( $order ) {
|
||||
*/
|
||||
function wcs_get_subscriptions_for_switch_order( $order ) {
|
||||
|
||||
if ( ! is_object( $order ) ) {
|
||||
if ( ! is_a( $order, 'WC_Abstract_Order' ) ) {
|
||||
$order = wc_get_order( $order );
|
||||
}
|
||||
|
||||
@@ -59,7 +59,12 @@ function wcs_get_subscriptions_for_switch_order( $order ) {
|
||||
$subscription_ids = wcs_get_objects_property( $order, 'subscription_switch', 'multiple' );
|
||||
|
||||
foreach ( $subscription_ids as $subscription_id ) {
|
||||
$subscriptions[ $subscription_id ] = wcs_get_subscription( $subscription_id );
|
||||
|
||||
$subscription = wcs_get_subscription( $subscription_id );
|
||||
|
||||
if ( $subscription ) {
|
||||
$subscriptions[ $subscription_id ] = $subscription;
|
||||
}
|
||||
}
|
||||
|
||||
return $subscriptions;
|
||||
|
Reference in New Issue
Block a user