mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
Merge pull request #374 from woocommerce/PCP-425-save-your-credit-card-shouldnt-b
Do not display save credit card if subscription in the cart
This commit is contained in:
commit
016d72683a
4 changed files with 36 additions and 26 deletions
|
@ -3,16 +3,19 @@
|
||||||
= 1.6.2 - TBD =
|
= 1.6.2 - TBD =
|
||||||
* Fix - Order of WooCommerce checkout actions causing incompatibility with AvaTax address validation #335
|
* Fix - Order of WooCommerce checkout actions causing incompatibility with AvaTax address validation #335
|
||||||
* Fix - Can't checkout to certain countries with optional postcode #330
|
* Fix - Can't checkout to certain countries with optional postcode #330
|
||||||
* FIx - Prevent subscription from being purchased when saving payment fails #308
|
* Fix - Prevent subscription from being purchased when saving payment fails #308
|
||||||
* FIx - Guest users must checkout twice for subscriptions, no smart buttons loaded #342
|
* Fix - Guest users must checkout twice for subscriptions, no smart buttons loaded #342
|
||||||
* FIx - Failed PayPal API request causing strange error #347
|
* Fix - Failed PayPal API request causing strange error #347
|
||||||
* FIx - PayPal payments page empty after switching packages #350
|
* Fix - PayPal payments page empty after switching packages #350
|
||||||
* FIx - Could Not Validate Nonce Error #239
|
* Fix - Could Not Validate Nonce Error #239
|
||||||
* FIx - Refund via PayPal dashboard does not set the WooCommerce order to "Refunded" #241
|
* Fix - Refund via PayPal dashboard does not set the WooCommerce order to "Refunded" #241
|
||||||
* FIx - Uncaught TypeError: round() #344
|
* Fix - Uncaught TypeError: round() #344
|
||||||
* FIx - Broken multi-level (nested) associative array values after getting submitted from checkout page #307
|
* Fix - Broken multi-level (nested) associative array values after getting submitted from checkout page #307
|
||||||
* FIx - Transaction id missing in some cases #328
|
* Fix - Transaction id missing in some cases #328
|
||||||
* FIx - Payment not possible in pay for order form because of terms checkbox missing #294
|
* Fix - Payment not possible in pay for order form because of terms checkbox missing #294
|
||||||
|
* Fix - "Save your Credit Card" shouldn't be optional when paying for a subscription #368
|
||||||
|
* Fix - When paying for a subscription and vaulting fails, cart is cleared #367
|
||||||
|
* Fix - Fatal error when activating PayPal Checkout plugin #363
|
||||||
|
|
||||||
= 1.6.1 - 2021-10-12 =
|
= 1.6.1 - 2021-10-12 =
|
||||||
* Fix - Handle authorization capture failures #312
|
* Fix - Handle authorization capture failures #312
|
||||||
|
|
|
@ -199,14 +199,18 @@ class SmartButton implements SmartButtonInterface {
|
||||||
11
|
11
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$subscription_helper = $this->subscription_helper;
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_credit_card_form_fields',
|
'woocommerce_credit_card_form_fields',
|
||||||
function ( $default_fields, $id ) {
|
function ( array $default_fields, $id ) use ( $subscription_helper ) : array {
|
||||||
if ( is_user_logged_in() && $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ) && CreditCardGateway::ID === $id ) {
|
if ( is_user_logged_in() && $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ) && CreditCardGateway::ID === $id ) {
|
||||||
$default_fields['card-vault'] = sprintf(
|
|
||||||
'<p class="form-row form-row-wide"><label for="vault"><input class="ppcp-credit-card-vault" type="checkbox" id="ppcp-credit-card-vault" name="vault">%s</label></p>',
|
if ( ! $subscription_helper->cart_contains_subscription() ) {
|
||||||
esc_html__( 'Save your Credit Card', 'woocommerce-paypal-payments' )
|
$default_fields['card-vault'] = sprintf(
|
||||||
);
|
'<p class="form-row form-row-wide"><label for="vault"><input class="ppcp-credit-card-vault" type="checkbox" id="ppcp-credit-card-vault" name="vault">%s</label></p>',
|
||||||
|
esc_html__( 'Save your Credit Card', 'woocommerce-paypal-payments' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$tokens = $this->payment_token_repository->all_for_user_id( get_current_user_id() );
|
$tokens = $this->payment_token_repository->all_for_user_id( get_current_user_id() );
|
||||||
if ( $tokens && $this->payment_token_repository->tokens_contains_card( $tokens ) ) {
|
if ( $tokens && $this->payment_token_repository->tokens_contains_card( $tokens ) ) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ class SubscriptionHelper {
|
||||||
if ( ! isset( $item['data'] ) || ! is_a( $item['data'], \WC_Product::class ) ) {
|
if ( ! isset( $item['data'] ) || ! is_a( $item['data'], \WC_Product::class ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( $item['data']->is_type( 'subscription' ) ) {
|
if ( $item['data']->is_type( 'subscription' ) || $item['data']->is_type( 'subscription_variation' ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
23
readme.txt
23
readme.txt
|
@ -84,16 +84,19 @@ Follow the steps below to connect the plugin to your PayPal account:
|
||||||
= 1.6.2 =
|
= 1.6.2 =
|
||||||
* Fix - Order of WooCommerce checkout actions causing incompatibility with AvaTax address validation #335
|
* Fix - Order of WooCommerce checkout actions causing incompatibility with AvaTax address validation #335
|
||||||
* Fix - Can't checkout to certain countries with optional postcode #330
|
* Fix - Can't checkout to certain countries with optional postcode #330
|
||||||
* FIx - Prevent subscription from being purchased when saving payment fails #308
|
* Fix - Prevent subscription from being purchased when saving payment fails #308
|
||||||
* FIx - Guest users must checkout twice for subscriptions, no smart buttons loaded #342
|
* Fix - Guest users must checkout twice for subscriptions, no smart buttons loaded #342
|
||||||
* FIx - Failed PayPal API request causing strange error #347
|
* Fix - Failed PayPal API request causing strange error #347
|
||||||
* FIx - PayPal payments page empty after switching packages #350
|
* Fix - PayPal payments page empty after switching packages #350
|
||||||
* FIx - Could Not Validate Nonce Error #239
|
* Fix - Could Not Validate Nonce Error #239
|
||||||
* FIx - Refund via PayPal dashboard does not set the WooCommerce order to "Refunded" #241
|
* Fix - Refund via PayPal dashboard does not set the WooCommerce order to "Refunded" #241
|
||||||
* FIx - Uncaught TypeError: round() #344
|
* Fix - Uncaught TypeError: round() #344
|
||||||
* FIx - Broken multi-level (nested) associative array values after getting submitted from checkout page #307
|
* Fix - Broken multi-level (nested) associative array values after getting submitted from checkout page #307
|
||||||
* FIx - Transaction id missing in some cases #328
|
* Fix - Transaction id missing in some cases #328
|
||||||
* FIx - Payment not possible in pay for order form because of terms checkbox missing #294
|
* Fix - Payment not possible in pay for order form because of terms checkbox missing #294
|
||||||
|
* Fix - "Save your Credit Card" shouldn't be optional when paying for a subscription #368
|
||||||
|
* Fix - When paying for a subscription and vaulting fails, cart is cleared #367
|
||||||
|
* Fix - Fatal error when activating PayPal Checkout plugin #363
|
||||||
|
|
||||||
= 1.6.1 =
|
= 1.6.1 =
|
||||||
* Fix - Handle authorization capture failures #312
|
* Fix - Handle authorization capture failures #312
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue