Skip to content

Commit

Permalink
Make the checkbox on the change payment method page which updates all…
Browse files Browse the repository at this point in the history
… subscriptions enabled by default (#588)

* Implement a modal to confirm whether customers want to update all of their subscriptions

* Remove checkbox from main change payment method template

* Add changelog entry

* Revert "Implement a modal to confirm whether customers want to update all of their subscriptions"

This reverts commit af1294d.

* Bring back the original checkbox but make it enabled by default

* Update changelog entry

* fix inline comment
  • Loading branch information
mattallan authored Mar 27, 2024
1 parent 5d3833b commit 96e5ddd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Fix - Improved alignment of subscription product pricing fields on the edit product screen for consistency with other fields.
* Fix - Avoid setting empty meta keys on subscriptions when changing the customer's default payment method.
* Fix - Use a more scalable way to filter the orders admin list table by parent orders on HPOS stores.
* Update - Change the update all subscriptions checkbox displayed on the change payment method page to be enabled by default.

= 6.8.0 - 2024-02-08 =
* Fix - Block the UI after a customer clicks actions on the My Account > Subscriptions page to prevent multiple requests from being sent.
Expand Down
16 changes: 8 additions & 8 deletions templates/checkout/form-change-payment-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Pay for order form displayed after a customer has clicked the "Change Payment method" button
* next to a subscription on their My Account page.
*
* @author Prospress
* @package WooCommerce/Templates
* @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0
*/
Expand Down Expand Up @@ -52,8 +51,9 @@
$pay_order_button_text = apply_filters( 'woocommerce_change_payment_button_text', $pay_order_button_text );
$customer_subscription_ids = WCS_Customer_Store::instance()->get_users_subscription_ids( $subscription->get_customer_id() );
$payment_gateways_handler = WC_Subscriptions_Core_Plugin::instance()->get_gateways_handler_class();
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();

if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateways() ) :
if ( $available_gateways ) :
?>
<ul class="payment_methods methods">
<?php
Expand Down Expand Up @@ -89,21 +89,21 @@
<span class="update-all-subscriptions-payment-method-wrap">
<?php
// translators: $1: opening <strong> tag, $2: closing </strong> tag
$label = sprintf( esc_html__( 'Update the payment method used for %1$sall%2$s of my current subscriptions', 'woocommerce-subscriptions' ), '<strong>', '</strong>' );
$label = sprintf( esc_html__( 'Use this payment method for %1$sall%2$s of my current subscriptions', 'woocommerce-subscriptions' ), '<strong>', '</strong>' );

woocommerce_form_field(
'update_all_subscriptions_payment_method',
array(
'type' => 'checkbox',
'class' => array( 'form-row-wide' ),
'label' => $label,
'default' => apply_filters( 'wcs_update_all_subscriptions_payment_method_checked', false ),
'type' => 'checkbox',
'class' => array( 'form-row-wide' ),
'label' => $label,
'required' => true, // Making the field required to help make it more prominent on the page.
'default' => apply_filters( 'wcs_update_all_subscriptions_payment_method_checked', true ),
)
);
?>
</span>
<?php endif; ?>

<div class="form-row">
<?php wp_nonce_field( 'wcs_change_payment_method', '_wcsnonce', true, true ); ?>

Expand Down

0 comments on commit 96e5ddd

Please sign in to comment.