Skip to content

Commit

Permalink
Add WC Pay version compatibility check -- action is only available on…
Browse files Browse the repository at this point in the history
… version 2.9.0+
  • Loading branch information
moon0326 committed Aug 25, 2021
1 parent a0a5a29 commit 4e9a4fb
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,10 @@ function ( $payment_gateway ) {
$enabled_payment_options = array_keys( $enabled_payment_options );
$include_express_payment = false;

$wcpay_version = get_option( 'woocommerce_woocommerce_payments_version' );
$has_required_wcpay_version = version_compare( $wcpay_version, '2.9.0', '>=' );
// Check express payment availablity only if WC Pay is enabled and express checkout (payment request) is enabled.
if ( in_array( 'woocommerce_payments', $enabled_payment_options, true ) ) {
if ( in_array( 'woocommerce_payments', $enabled_payment_options, true ) && $has_required_wcpay_version ) {
$wcpay_settings = get_option( 'woocommerce_woocommerce_payments_settings', array() );
if ( array_key_exists( 'payment_request', $wcpay_settings ) && 'yes' === $wcpay_settings['payment_request'] ) {
$include_express_payment = true;
Expand Down

0 comments on commit 4e9a4fb

Please sign in to comment.