public/wordpress/wp-content/plugins/wp-courseware/includes/gateways/gateway-paypal.php
/**
	 * Can we proceed processing the payment?
	 *
	 * @since 4.3.0
	 *
	 * @param Order $order The order object.
	 *
	 * @return bool True if validated, false otherwise.
	 */
Can we proceed processing the payment.

@param Order $order The order object.

@return bool True if validated, false otherwise.
Can we proceed processing the payment . @param Order $order The order object . @return bool True if validated false otherwise .
protected function can_process_payment( $order ) {
		$items = $order->get_order_items();
		if ( empty( $items ) ) {
			wpcw_add_notice( esc_html__( 'It appears your cart is empty. Please try again.', 'wp-courseware' ), 'error' );
		}
		$subscription_items = 0;
		$one_time_items     = 0;
		foreach ( $items as $item ) {
			if ( $item instanceof Order_Item ) {
				if ( $item->get_is_recurring() || $item->get_use_installments() ) {
					$subscription_items ++;
				} else {
					$one_time_items ++;
				}
			}
		}
		if ( $subscription_items > 1 ) {
			wpcw_add_notice( esc_html__( 'You cannot purchase multiple subscriptions together when using PayPal.', 'wp-courseware' ), 'error' );
			return false;
		} elseif ( $subscription_items === 1 && $one_time_items >= 1 ) {
			wpcw_add_notice( esc_html__( 'Subscriptions and a one-time courses cannot be purchased together using PayPal.', 'wp-courseware' ), 'error' );
			return false;
		}
		if ( $subscription_items ) {
			$this->is_subscription = true;
		}
		return true;
	}
protected function can_process_payment ( $ order ) { $ items = $ order -> get_order_items ( ) ; if ( empty ( $ items ) ) { wpcw_add_notice ( esc_html__ ( 'It appears your cart is empty. Please try again.' , 'wp-courseware' ) , 'error' ) ; } $ subscription_items = 0 ; $ one_time_items = 0 ; foreach ( $ items as $ item ) { if ( $ item instanceof Order_Item ) { if ( $ item -> get_is_recurring ( ) || $ item -> get_use_installments ( ) ) { $ subscription_items ++ ; } else { $ one_time_items ++ ; } } } if ( $ subscription_items > 1 ) { wpcw_add_notice ( esc_html__ ( 'You cannot purchase multiple subscriptions together when using PayPal.' , 'wp-courseware' ) , 'error' ) ; return false ; } elseif ( $ subscription_items === 1 && $ one_time_items >= 1 ) { wpcw_add_notice ( esc_html__ ( 'Subscriptions and a one-time courses cannot be purchased together using PayPal.' , 'wp-courseware' ) , 'error' ) ; return false ; } if ( $ subscription_items ) { $ this -> is_subscription = true ; } return true ; }
Can we proceed processing the payment?
Can we proceed processing the payment?