Merge pull request #2935 from woocommerce/PCP-4035-standard-card-button-not-disaplayed-in-standalone-gateway-when-free-trial-subscription-is-in-the-cart

Standard Card Button not disaplayed in standalone gateway when free trial subscription is in the cart
This commit is contained in:
Emili Castells 2025-01-23 10:51:51 +01:00 committed by GitHub
commit 50b3a58106
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -362,4 +362,19 @@ class CardButtonGateway extends \WC_Payment_Gateway {
protected function settings_renderer(): SettingsRenderer {
return $this->settings_renderer;
}
/**
* Determines if the Gateway is available for use.
*
* @return bool
*/
public function is_available(): bool {
$is_available = parent::is_available();
if ( $is_available && $this->is_free_trial_cart() ) {
$is_available = false;
}
return $is_available;
}
}