Skip to content

Commit

Permalink
Fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
Emili Castells Guasch authored and Emili Castells Guasch committed Dec 18, 2023
1 parent ab09da9 commit ef9ee06
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,15 @@ public function paypal_subscription_id(): string {
}

if ( $product->get_type() === 'variable-subscription' ) {
/**
* The method is defined in WC_Product_Variable class.
*
* @psalm-suppress UndefinedMethod
*/
$product_variations = $product->get_available_variations();
foreach ( $product_variations as $variation ) {
$variation_product = wc_get_product( $variation['variation_id'] );
if ( $variation_product->meta_exists( 'ppcp_subscription_plan' ) ) {
if ( $variation_product !== null && $variation_product !== false && $variation_product->meta_exists( 'ppcp_subscription_plan' ) ) {
return $variation_product->get_meta( 'ppcp_subscription_plan' )['id'];
}
}
Expand Down

0 comments on commit ef9ee06

Please sign in to comment.