Fix Subscriptions autorenewals column for WooPayments pre-install promo in Settings > Payments (#43436)

* Do not sanitize WooCommerce Subscriptiion column HTML in Settings > Payments methods table

* Add features supports entry to pseudo-gateway WCPay Promotion

* Add changelog

* Add changelog entry for woocommerce-admin

* Lint fixes
This commit is contained in:
Vlad Olaru 2024-01-12 19:05:29 +02:00 committed by GitHub
parent ee6642e0c7
commit 469b74433c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Do not sanitize HTML for WooCommerce Subscriptions column in Settings > Payments > Payment Methods table.

View File

@ -194,7 +194,8 @@ export const PaymentPromotionRow: React.FC< PaymentPromotionRowProps > = ( {
className={ column.className }
width={ column.width }
dangerouslySetInnerHTML={
column.className.includes( 'sort' )
column.className.includes( 'sort' ) ||
column.className.includes( 'renewals' )
? {
__html: column.html,
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Add supports entry to pseudo-gateway for WooPayments pre-install promotion.

View File

@ -36,6 +36,34 @@ class WCPaymentGatewayPreInstallWCPayPromotion extends \WC_Payment_Gateway {
$this->method_description = $wc_pay_spec->content;
$this->has_fields = false;
// Set the promotion pseudo-gateway support features.
// If the promotion spec provides the supports property, use it.
if ( property_exists( $wc_pay_spec, 'supports' ) ) {
$this->supports = $wc_pay_spec->supports;
} else {
// Otherwise, use the default supported features in line with WooPayments ones.
// We include all features here, even if some of them are behind settings, since this is for info only.
$this->supports = array(
// Regular features.
'products',
'refunds',
// Subscriptions features.
'subscriptions',
'multiple_subscriptions',
'subscription_cancellation',
'subscription_reactivation',
'subscription_suspension',
'subscription_amount_changes',
'subscription_date_changes',
'subscription_payment_method_change_admin',
'subscription_payment_method_change_customer',
'subscription_payment_method_change',
// Saved cards features.
'tokenization',
'add_payment_method',
);
}
// Get setting values.
$this->enabled = false;