$subscription ) { $recipient_user_id = WCS_Gifting::get_recipient_user( $subscription ); if ( ! empty( $recipient_user_id ) && $recipient_user_id != $user_id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison unset( $subscriptions[ $subscription_id ] ); } } } elseif ( 'billing' === get_query_var( 'edit-address' ) ) { // We dont want to update the billing address of gifted subscriptions for this user. foreach ( $subscriptions as $subscription_id => $subscription ) { $recipient_user_id = WCS_Gifting::get_recipient_user( $subscription ); if ( ! empty( $recipient_user_id ) && $recipient_user_id == $user_id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison unset( $subscriptions[ $subscription_id ] ); } } } } return $subscriptions; } /** * Appends a notice to the 'update all subscriptions addresses' checkbox notifing the customer that updating all * subscription addresses will not update gifted subscriptions, depending on which address is being updated. * * @param string $field The generated html element field string. * @param string $field_id The id attribute of the html element being generated. */ public static function display_update_all_addresses_notice( $field, $field_id ) { if ( 'update_all_subscriptions_addresses' === $field_id && ( 'shipping' === get_query_var( 'edit-address' ) || 'billing' === get_query_var( 'edit-address' ) ) ) { switch ( get_query_var( 'edit-address' ) ) { case 'shipping': // Translators: 1) opening tag, 2) closing tag. $field = substr_replace( $field, '' . sprintf( esc_html__( '%1$sNote:%2$s This will not update the shipping address of subscriptions you have purchased for others.', 'woocommerce-subscriptions' ), '', '' ) . '', strpos( $field, '

' ), 0 ); break; case 'billing': // Translators: 1) opening tag, 2) closing tag. $field = substr_replace( $field, '' . sprintf( esc_html__( '%1$sNote:%2$s This will not update the billing address of subscriptions purchased for you by someone else.', 'woocommerce-subscriptions' ), '', '' ) . '', strpos( $field, '

' ), 0 ); break; } } return $field; } }