Commit d5842d766f5 for woocommerce
commit d5842d766f50762054cc43d97f92d8e0789e985b
Author: Luigi Teschio <gigitux@gmail.com>
Date: Tue Aug 11 14:34:26 2026 +0200
Update Blocks deprecation notices to use Core versions (#67615)
* Update Blocks deprecation notices to use Core versions
* Add changelog entry for Core deprecation versions
* Remove newly added deprecation since values
* fix unit test
diff --git a/plugins/woocommerce/changelog/fix-46459-core-deprecation-versions b/plugins/woocommerce/changelog/fix-46459-core-deprecation-versions
new file mode 100644
index 00000000000..18591c0c21b
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-46459-core-deprecation-versions
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Use WooCommerce Core versions in JavaScript deprecation notices.
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/payment-methods/use-payment-method-interface.ts b/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/payment-methods/use-payment-method-interface.ts
index 78c46b2a718..d30a1c47e7e 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/payment-methods/use-payment-method-interface.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/payment-methods/use-payment-method-interface.ts
@@ -93,33 +93,29 @@ export const usePaymentMethodInterface = (): PaymentMethodInterface => {
isDoingExpressPayment: paymentIsDoingExpressPayment,
get isPristine() {
deprecated( 'isPristine', {
- since: '9.6.0',
+ since: '7.5.0',
alternative: 'isIdle',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return paymentIsIdle;
},
get isFinished() {
deprecated( 'isFinished', {
- since: '9.6.0',
- plugin: 'WooCommerce Blocks',
+ since: '7.5.0',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return paymentHasError || paymentIsReady;
},
get hasFailed() {
deprecated( 'hasFailed', {
- since: '9.6.0',
- plugin: 'WooCommerce Blocks',
+ since: '7.5.0',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return paymentHasError;
},
get isSuccessful() {
deprecated( 'isSuccessful', {
- since: '9.6.0',
- plugin: 'WooCommerce Blocks',
+ since: '7.5.0',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return paymentIsReady;
@@ -178,7 +174,6 @@ export const usePaymentMethodInterface = (): PaymentMethodInterface => {
'setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).',
{
alternative: '',
- plugin: 'woocommerce-gutenberg-products-block',
link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228',
}
);
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/checkout-events/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/checkout-events/index.tsx
index 8e6881b426c..57095108fa3 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/checkout-events/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/checkout-events/index.tsx
@@ -240,7 +240,6 @@ export const CheckoutEventsProvider = ( {
return function ( ...args: Parameters< typeof onCheckoutValidation > ) {
deprecated( 'onCheckoutBeforeProcessing', {
alternative: 'onCheckoutValidation',
- plugin: 'WooCommerce Blocks',
} );
return onCheckoutValidation( ...args );
};
@@ -252,9 +251,8 @@ export const CheckoutEventsProvider = ( {
const onCheckoutValidationBeforeProcessing = useMemo( () => {
return function ( ...args: Parameters< typeof onCheckoutValidation > ) {
deprecated( 'onCheckoutValidationBeforeProcessing', {
- since: '9.7.0',
+ since: '7.6.0',
alternative: 'onCheckoutValidation',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8381',
} );
return onCheckoutValidation( ...args );
@@ -267,9 +265,8 @@ export const CheckoutEventsProvider = ( {
const onCheckoutAfterProcessingWithSuccess = useMemo( () => {
return function ( ...args: Parameters< typeof onCheckoutSuccess > ) {
deprecated( 'onCheckoutAfterProcessingWithSuccess', {
- since: '9.7.0',
+ since: '7.6.0',
alternative: 'onCheckoutSuccess',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8381',
} );
return onCheckoutSuccess( ...args );
@@ -282,9 +279,8 @@ export const CheckoutEventsProvider = ( {
const onCheckoutAfterProcessingWithError = useMemo( () => {
return function ( ...args: Parameters< typeof onCheckoutFail > ) {
deprecated( 'onCheckoutAfterProcessingWithError', {
- since: '9.7.0',
+ since: '7.6.0',
alternative: 'onCheckoutFail',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8381',
} );
return onCheckoutFail( ...args );
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/payment-events/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/payment-events/index.tsx
index 52fad90cb32..27b2fa08c76 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/payment-events/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/payment-events/index.tsx
@@ -141,7 +141,6 @@ export const PaymentEventsProvider = ( {
return function ( ...args: Parameters< typeof onPaymentSetup > ) {
deprecated( 'onPaymentProcessing', {
alternative: 'onPaymentSetup',
- plugin: 'WooCommerce Blocks',
} );
return onPaymentSetup( ...args );
};
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/express-payment-methods.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/express-payment-methods.tsx
index 750676fa111..964abc0533c 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/express-payment-methods.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/express-payment-methods.tsx
@@ -141,7 +141,6 @@ const ExpressPaymentMethods = () => {
'Express Payment Methods should use the provided onError handler instead.',
{
alternative: 'onError',
- plugin: 'woocommerce-gutenberg-products-block',
link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228',
}
);
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/test/express-payment-methods.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/test/express-payment-methods.tsx
index 4fec31c85fd..d84d22f93b3 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/test/express-payment-methods.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/payment-methods/test/express-payment-methods.tsx
@@ -234,7 +234,7 @@ describe( 'Express payment methods', () => {
// usePaymentMethodInterface hook is called so we need to expect it here otherwise
// the test fails on unexpected console warnings.
expect( console ).toHaveWarnedWith(
- 'isPristine is deprecated since version 9.6.0. Please use isIdle instead. See: https://github.com/woocommerce/woocommerce-blocks/pull/8110'
+ 'isPristine is deprecated since version 7.5.0. Please use isIdle instead. See: https://github.com/woocommerce/woocommerce-blocks/pull/8110'
);
} );
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/selectors.ts b/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/selectors.ts
index 13b3576fc08..50b3d471e29 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/selectors.ts
+++ b/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/selectors.ts
@@ -26,9 +26,8 @@ if ( getSetting( 'globalPaymentMethods' ) ) {
export const isPaymentPristine = ( state: PaymentState ) => {
deprecated( 'isPaymentPristine', {
- since: '9.6.0',
+ since: '7.5.0',
alternative: 'isPaymentIdle',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
@@ -40,9 +39,8 @@ export const isPaymentIdle = ( state: PaymentState ) =>
export const isPaymentStarted = ( state: PaymentState ) => {
deprecated( 'isPaymentStarted', {
- since: '9.6.0',
+ since: '7.5.0',
alternative: 'isExpressPaymentStarted',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return state.status === PAYMENT_STATUS.EXPRESS_STARTED;
@@ -60,9 +58,8 @@ export const isPaymentReady = ( state: PaymentState ) =>
export const isPaymentSuccess = ( state: PaymentState ) => {
deprecated( 'isPaymentSuccess', {
- since: '9.6.0',
+ since: '7.5.0',
alternative: 'isPaymentReady',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
@@ -74,8 +71,7 @@ export const hasPaymentError = ( state: PaymentState ) =>
export const isPaymentFailed = ( state: PaymentState ) => {
deprecated( 'isPaymentFailed', {
- since: '9.6.0',
- plugin: 'WooCommerce Blocks',
+ since: '7.5.0',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
@@ -187,18 +183,16 @@ export const expressPaymentMethodsInitialized = ( state: PaymentState ) => {
*/
export const getCurrentStatus = ( state: PaymentState ) => {
deprecated( 'getCurrentStatus', {
- since: '8.9.0',
+ since: '7.2.0',
alternative: 'isPaymentIdle, isPaymentProcessing, hasPaymentError',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/7666',
} );
return {
get isPristine() {
deprecated( 'isPristine', {
- since: '9.6.0',
+ since: '7.5.0',
alternative: 'isIdle',
- plugin: 'WooCommerce Blocks',
} );
return isPaymentIdle( state );
}, // isPristine is the same as isIdle.
@@ -207,8 +201,7 @@ export const getCurrentStatus = ( state: PaymentState ) => {
isProcessing: isPaymentProcessing( state ),
get isFinished() {
deprecated( 'isFinished', {
- since: '9.6.0',
- plugin: 'WooCommerce Blocks',
+ since: '7.5.0',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return hasPaymentError( state ) || isPaymentReady( state );
@@ -216,16 +209,14 @@ export const getCurrentStatus = ( state: PaymentState ) => {
hasError: hasPaymentError( state ),
get hasFailed() {
deprecated( 'hasFailed', {
- since: '9.6.0',
- plugin: 'WooCommerce Blocks',
+ since: '7.5.0',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return hasPaymentError( state );
},
get isSuccessful() {
deprecated( 'isSuccessful', {
- since: '9.6.0',
- plugin: 'WooCommerce Blocks',
+ since: '7.5.0',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8110',
} );
return isPaymentReady( state );
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/thunks.ts b/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/thunks.ts
index 9f107a12489..8cecb62b22c 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/thunks.ts
+++ b/plugins/woocommerce/client/blocks/packages/public-api/block-data/payment/thunks.ts
@@ -119,9 +119,9 @@ export const __internalEmitPaymentProcessingEvent: emitProcessingEventType = (
// Set this here so that old extensions still using billingData can set the billingAddress.
billingAddress = billingDataFromResponse as BillingAddress;
deprecated(
- 'returning billingData from an onPaymentProcessing observer in WooCommerce Blocks',
+ 'returning billingData from an onPaymentProcessing observer',
{
- version: '9.5.0',
+ version: '7.5.0',
alternative: 'billingAddress',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/6369',
}
@@ -136,9 +136,9 @@ export const __internalEmitPaymentProcessingEvent: emitProcessingEventType = (
shippingAddress =
shippingDataFromResponse.address as ShippingAddress;
deprecated(
- 'returning shippingData from an onPaymentProcessing observer in WooCommerce Blocks',
+ 'returning shippingData from an onPaymentProcessing observer',
{
- version: '9.5.0',
+ version: '7.5.0',
alternative: 'shippingAddress',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8163',
}
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/block-data/validation/actions.ts b/plugins/woocommerce/client/blocks/packages/public-api/block-data/validation/actions.ts
index 0b5be002b44..297951422cd 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/block-data/validation/actions.ts
+++ b/plugins/woocommerce/client/blocks/packages/public-api/block-data/validation/actions.ts
@@ -28,9 +28,8 @@ export const clearValidationErrors = ( errors?: string[] | undefined ) => ( {
export const clearAllValidationErrors = () => {
deprecated( 'clearAllValidationErrors', {
- version: '9.0.0',
+ version: '7.3.0',
alternative: 'clearValidationErrors',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/7601',
hint: 'Calling `clearValidationErrors` with no arguments will clear all validation errors.',
} );
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-checkout/filter-registry/index.ts b/plugins/woocommerce/client/blocks/packages/public-api/blocks-checkout/filter-registry/index.ts
index 402cdccfe40..9fe8c696b13 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-checkout/filter-registry/index.ts
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-checkout/filter-registry/index.ts
@@ -49,7 +49,6 @@ export const registerCheckoutFilters = (
if ( Object.keys( filters ).includes( 'couponName' ) ) {
deprecated( 'couponName', {
alternative: 'coupons',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/bb921d21f42e21f38df2b1c87b48e07aa4cb0538/docs/extensibility/available-filters.md#coupons',
} );
}
@@ -71,9 +70,8 @@ export const __experimentalRegisterCheckoutFilters = (
) => {
deprecated( '__experimentalRegisterCheckoutFilters', {
alternative: 'registerCheckoutFilters',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8346',
- since: '9.6.0',
+ since: '7.5.0',
hint: '__experimentalRegisterCheckoutFilters has graduated to stable and this experimental function will be removed.',
} );
registerCheckoutFilters( namespace, filters );
@@ -279,9 +277,8 @@ export const __experimentalApplyCheckoutFilter = < T >( {
} ): T => {
deprecated( '__experimentalApplyCheckoutFilter', {
alternative: 'applyCheckoutFilter',
- plugin: 'WooCommerce Blocks',
link: 'https://github.com/woocommerce/woocommerce-blocks/pull/8346',
- since: '9.6.0',
+ since: '7.5.0',
hint: '__experimentalApplyCheckoutFilter has graduated to stable and this experimental function will be removed.',
} );
return applyCheckoutFilter( {
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/get-registered-block-components.ts b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/get-registered-block-components.ts
index 59fa68d94cb..733f53138f4 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/get-registered-block-components.ts
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/get-registered-block-components.ts
@@ -47,9 +47,8 @@ export function getRegisteredInnerBlocks(
main: string
): Record< string, RegisteredBlockComponent > {
deprecated( 'getRegisteredInnerBlocks', {
- version: '2.8.0',
+ version: '4.4.0',
alternative: 'getRegisteredBlockComponents',
- plugin: 'WooCommerce Blocks',
} );
return getRegisteredBlockComponents( main );
}
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/register-block-component.js b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/register-block-component.js
index bef5ef821dc..be4265fb130 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/register-block-component.js
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/block-components/register-block-component.js
@@ -93,9 +93,8 @@ export function registerBlockComponent( options ) {
*/
export function registerInnerBlock( options ) {
deprecated( 'registerInnerBlock', {
- version: '2.8.0',
+ version: '4.4.0',
alternative: 'registerBlockComponent',
- plugin: 'WooCommerce Blocks',
hint: '"main" has been replaced with "context" and is now optional.',
} );
assertOption( options, 'main', 'string' );
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/payment-method-config.tsx b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/payment-method-config.tsx
index 9ec09ebb687..6ecf9825279 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/payment-method-config.tsx
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/payment-method-config.tsx
@@ -159,7 +159,6 @@ export default class PaymentMethodConfig
'Passing savePaymentInfo when registering a payment method.',
{
alternative: 'Pass showSavedCards and showSaveOption',
- plugin: 'woocommerce-gutenberg-products-block',
link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3686',
}
);
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/registry.ts b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/registry.ts
index f65b5c272d9..ff24b9b011c 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/registry.ts
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-registry/payment-methods/registry.ts
@@ -46,7 +46,6 @@ export const registerPaymentMethod = (
paymentMethodConfig = options( PaymentMethodConfig );
deprecated( 'Passing a callback to registerPaymentMethod()', {
alternative: 'a config options object',
- plugin: 'woocommerce-gutenberg-products-block',
link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3404',
} );
} else {
@@ -72,7 +71,6 @@ export const registerExpressPaymentMethod = (
paymentMethodConfig = options( ExpressPaymentMethodConfig );
deprecated( 'Passing a callback to registerExpressPaymentMethod()', {
alternative: 'a config options object',
- plugin: 'woocommerce-gutenberg-products-block',
link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3404',
} );
} else {