Commit ecd20437c0b for woocommerce
commit ecd20437c0b99c766314b7447889717749d31888
Author: Tom Cafferkey <tjcafferkey@gmail.com>
Date: Thu Oct 29 13:21:57 2026 +0000
Fix the Cart block’s checkout step number setting (#70338)
* Fix cart block step number setting
* Add changelog entry for cart setting fix
diff --git a/plugins/woocommerce/changelog/fix-cart-step-number-setting b/plugins/woocommerce/changelog/fix-cart-step-number-setting
new file mode 100644
index 00000000000..85741700446
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-cart-step-number-setting
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Remove the checkout step numbers setting from the Cart block.
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/block-settings/index.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/block-settings/index.tsx
index adeff2cfa6c..18ff7e819c4 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/block-settings/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/block-settings/index.tsx
@@ -9,24 +9,28 @@ import type { BlockAttributes } from '@wordpress/blocks';
export const BlockSettings = ( {
attributes,
setAttributes,
+ blockType,
}: {
attributes: BlockAttributes;
setAttributes: ( attrs: BlockAttributes ) => void;
+ blockType: 'cart' | 'checkout';
} ) => {
const { hasDarkControls, showFormStepNumbers } = attributes;
return (
<InspectorControls>
<PanelBody title={ __( 'Style', 'woocommerce' ) }>
- <ToggleControl
- __nextHasNoMarginBottom
- label={ __( 'Show form step numbers', 'woocommerce' ) }
- checked={ showFormStepNumbers }
- onChange={ () =>
- setAttributes( {
- showFormStepNumbers: ! showFormStepNumbers,
- } )
- }
- />
+ { blockType === 'checkout' && (
+ <ToggleControl
+ __nextHasNoMarginBottom
+ label={ __( 'Show form step numbers', 'woocommerce' ) }
+ checked={ showFormStepNumbers }
+ onChange={ () =>
+ setAttributes( {
+ showFormStepNumbers: ! showFormStepNumbers,
+ } )
+ }
+ />
+ ) }
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Dark mode inputs', 'woocommerce' ) }
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/block-settings/test/index.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/block-settings/test/index.tsx
new file mode 100644
index 00000000000..7bfc79616e3
--- /dev/null
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart-checkout-shared/block-settings/test/index.tsx
@@ -0,0 +1,52 @@
+/**
+ * External dependencies
+ */
+import { fireEvent, render, screen } from '@testing-library/react';
+import type { ReactNode } from 'react';
+
+/**
+ * Internal dependencies
+ */
+import { BlockSettings } from '..';
+
+jest.mock( '@wordpress/block-editor', () => ( {
+ InspectorControls: ( { children }: { children: ReactNode } ) => children,
+} ) );
+
+describe( 'Cart and checkout block settings', () => {
+ it( 'shows dark mode but not step numbers for the cart', () => {
+ render(
+ <BlockSettings
+ attributes={ {} }
+ setAttributes={ jest.fn() }
+ blockType="cart"
+ />
+ );
+
+ expect(
+ screen.getByLabelText( 'Dark mode inputs' )
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByLabelText( 'Show form step numbers' )
+ ).toBeNull();
+ } );
+
+ it( 'allows checkout step numbers to be changed', () => {
+ const setAttributes = jest.fn();
+ render(
+ <BlockSettings
+ attributes={ { showFormStepNumbers: false } }
+ setAttributes={ setAttributes }
+ blockType="checkout"
+ />
+ );
+
+ fireEvent.click( screen.getByLabelText( 'Show form step numbers' ) );
+ expect( setAttributes ).toHaveBeenCalledWith( {
+ showFormStepNumbers: true,
+ } );
+ expect(
+ screen.getByLabelText( 'Dark mode inputs' )
+ ).toBeInTheDocument();
+ } );
+} );
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/edit.js b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/edit.js
index 836820d69f0..26de3751ea5 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/edit.js
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/edit.js
@@ -76,6 +76,7 @@ export const Edit = ( { clientId, className, attributes, setAttributes } ) => {
<BlockSettings
attributes={ attributes }
setAttributes={ setAttributes }
+ blockType="cart"
/>
</InspectorControls>
<BlockErrorBoundary
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/edit.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/edit.tsx
index fd0145baf2f..144cb0fa48d 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/edit.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/edit.tsx
@@ -128,6 +128,7 @@ export const Edit = ( {
<BlockSettings
attributes={ attributes }
setAttributes={ setAttributes }
+ blockType="checkout"
/>
</InspectorControls>
<EditorProvider