Commit 3e9034d7041 for woocommerce

commit 3e9034d70416c34fa87fee96f110b1771b695636
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu Nov 26 12:58:25 2026 +0000

    Add motion to totals rows (#70898)

    * Add the settled order summary hook from #70884

    useDelayedSkeleton and useSettledOrderSummaryValue only, with the
    current skeleton timing. #70884 replaces both; take its version when
    the stack is rebased onto trunk.

    * Add motion to totals rows

    Subtotal, Discount, Fee and Taxes rows grow in and collapse out when
    the totals skeletons end. The coupon form closes at the same speed, so
    the content below moves in one direction. Includes #70884's skeleton
    timing until it merges.

    * Keep keyboard coupon panel closes instant

    The coupon panel's margin transition outranked the panel's [data-wc-instant] rule, so the button gap still animated after a key press closed the form.

    * Record settled order summary values after commit

    The settled value and the last shown cart were written to refs during render, so a render React discards could leak into later renders. Write them in layout effects and return the current value while it is live.

    * Show Checkout discount row for filtered coupons

    The row's visibility checked the raw coupon list, so coupons that a coupons filter adds to an empty cart never showed. Trunk always rendered TotalsDiscount, which checks the filtered list.

    * Apply order summary rows at once after a key press

    Coupons applied or removed from the keyboard now show or hide their rows without motion, matching the motion rules.

    * Keep discounts slot mounted when the discount row toggles

    The slot now stays at the same child position, so extension fills keep their state.

    * Disable coupon chips while the discount row shows a stale cart

    After a removal, the row keeps the old coupons until the skeletons end. Their buttons were enabled again in that time, so a second click sent a removal that failed with an error notice. useOrderSummaryRow now returns isStale, and the discount rows disable their chips while it is true.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

    * Test that order summary rows stay stale while the skeletons hold

    The other tests run with reduced motion, which ends the skeletons at once. This one turns motion on and checks that the row keeps the old cart, and stays stale, until the skeleton timer ends.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

    * Use the shared exiting attributes for totals rows, and document isStale

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

    * Keep the discount row height while a coupon is removed

    The loading mask's minimum height made the row grow a little when the shopper clicked the X, and shrink again just before the row collapsed.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

    ---------

    Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

diff --git a/plugins/woocommerce/changelog/add-cart-checkout-motion-totals b/plugins/woocommerce/changelog/add-cart-checkout-motion-totals
new file mode 100644
index 00000000000..f089fff00a3
--- /dev/null
+++ b/plugins/woocommerce/changelog/add-cart-checkout-motion-totals
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+Discount, fee, and tax rows in the Cart and Checkout order summary now grow in and collapse out smoothly instead of jumping.
diff --git a/plugins/woocommerce/client/blocks/assets/css/abstracts/_motion.scss b/plugins/woocommerce/client/blocks/assets/css/abstracts/_motion.scss
index ce9d3d2af3b..0aa1430a07e 100644
--- a/plugins/woocommerce/client/blocks/assets/css/abstracts/_motion.scss
+++ b/plugins/woocommerce/client/blocks/assets/css/abstracts/_motion.scss
@@ -106,9 +106,9 @@ $wc-stagger-cap: 7;
 }

 // The timing for `animateCollapse` in base-utils. The space grows over `lg` and collapses over
-// `md`. The element always fades. With reduced motion, the space opens immediately, and closes after the fade.
-@mixin motion-collapse() {
-	$size: height, padding-top, padding-bottom, margin-top, margin-bottom;
+// `$out` (default `md`). The element always fades. With reduced motion, the space opens immediately, and closes after the fade.
+@mixin motion-collapse($out: md) {
+	$size: height, padding-top, padding-bottom, margin-top, margin-bottom, border-top-width, border-bottom-width;

 	&[data-wc-collapse] {
 		@include motion-transition($state: opacity, $move: $size, $easing: balanced);
@@ -124,7 +124,7 @@ $wc-stagger-cap: 7;
 		transition: motion-state(opacity), motion-hold($size...);

 		@include motion-safe {
-			transition: motion-move($size, md, balanced), motion-state(opacity);
+			transition: motion-move($size, $out, balanced), motion-state(opacity);
 		}
 	}
 }
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/coupon/style.scss b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/coupon/style.scss
index 941c3ffe405..e45c136f042 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/coupon/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/coupon/style.scss
@@ -49,3 +49,16 @@
 	flex-direction: column;
 	position: relative;
 }
+
+// When a coupon applies, the form closes at the same moment as the totals rows grow. Closing at the same speed keeps
+// the content below moving in one direction.
+:where(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon {
+	// Not after a key press, which applies immediately.
+	> .wc-block-components-panel__button[aria-expanded="false"]:not([data-wc-instant]) {
+		@include motion-transition($move: margin-bottom, $easing: balanced);
+	}
+
+	> .wc-block-components-panel__content {
+		@include motion-collapse($out: lg);
+	}
+}
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/index.tsx
index 2fa710e7e8b..66f00428a38 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/index.tsx
@@ -31,6 +31,8 @@ export interface TotalsDiscountProps {
 		'total_discount' | 'total_discount_tax'
 	>;
 	isLoading?: boolean;
+	// Disables the coupon buttons, for example while the row shows coupons that the cart no longer has.
+	disabled?: boolean;
 }

 const filteredCartCouponsFilterArg = {
@@ -44,6 +46,7 @@ const TotalsDiscount = ( {
 	removeCoupon,
 	values,
 	isLoading,
+	disabled = false,
 }: TotalsDiscountProps ): JSX.Element | null => {
 	const {
 		total_discount: totalDiscount,
@@ -95,7 +98,9 @@ const TotalsDiscount = ( {
 											__( 'Coupon: %s', 'woocommerce' ),
 											cartCoupon.label
 										) }
-										disabled={ isRemovingCoupon }
+										disabled={
+											isRemovingCoupon || disabled
+										}
 										onRemove={ () => {
 											removeCoupon( cartCoupon.code );
 										} }
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/style.scss b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/style.scss
index 4bbafe203b5..dba81fe0e05 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/style.scss
@@ -3,3 +3,9 @@
 	margin: $gap-smallest 0 0;
 	padding: 0;
 }
+
+// The mask only dims the coupons while one is removed. Its minimum height, which makes room for a spinner, would make
+// the row grow a little before it collapses.
+.wc-block-components-totals-discount .wc-block-components-loading-mask {
+	min-height: 0;
+}
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/test/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/test/index.tsx
index 0f8465f5ba9..83d05a8f4e5 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/test/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/totals/discount/test/index.tsx
@@ -416,6 +416,34 @@ describe( 'TotalsDiscount', () => {
 			expect( removeButton ).toBeDisabled();
 		} );

+		it( 'should disable remove buttons, without the loading mask, when disabled is true', () => {
+			const props = {
+				...defaultProps,
+				cartCoupons: [
+					{
+						code: 'COUPON1',
+						label: 'Test Coupon',
+						totals: {
+							...defaultCouponTotals,
+							total_discount: '500',
+							total_discount_tax: '0',
+						},
+					},
+				],
+				values: {
+					total_discount: '500',
+					total_discount_tax: '0',
+				},
+				disabled: true,
+			};
+			render( <TotalsDiscount { ...props } /> );
+
+			expect(
+				screen.getByLabelText( 'Remove coupon "Test Coupon"' )
+			).toBeDisabled();
+			expect( screen.getByTestId( 'not-loading' ) ).toBeInTheDocument();
+		} );
+
 		it( 'should not call removeCoupon when button is disabled', async () => {
 			const user = userEvent.setup();
 			const mockRemoveCoupon = jest.fn();
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx
index c8231897ef0..9e7d03f17d9 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/delayed-content-with-skeleton/index.tsx
@@ -23,14 +23,10 @@ export interface DelayedContentWithSkeletonProps {
 }

 /**
- * Component that ensures skeleton children are displayed for a minimum duration
- * to prevent jarring quick flashes when content loads fast
+ * Whether to show a skeleton: while `isLoading`, and for a minimum duration
+ * to prevent jarring quick flashes when content loads fast.
  */
-export const DelayedContentWithSkeleton = ( {
-	children,
-	isLoading,
-	skeleton,
-}: DelayedContentWithSkeletonProps ): JSX.Element => {
+export const useDelayedSkeleton = ( isLoading: boolean ): boolean => {
 	const disableMotion = useReducedMotion();
 	const [ showSkeleton, setShowSkeleton ] = useState( isLoading );
 	const [ startTime, setStartTime ] = useState< number | null >( null );
@@ -65,5 +61,20 @@ export const DelayedContentWithSkeleton = ( {
 		};
 	}, [ isLoading, startTime, disableMotion ] );

+	// `isLoading` too, so the skeleton shows in the same render as loading starts, not one effect later.
+	return isLoading || showSkeleton;
+};
+
+/**
+ * Component that ensures skeleton children are displayed for a minimum duration
+ * to prevent jarring quick flashes when content loads fast
+ */
+export const DelayedContentWithSkeleton = ( {
+	children,
+	isLoading,
+	skeleton,
+}: DelayedContentWithSkeletonProps ): JSX.Element => {
+	const showSkeleton = useDelayedSkeleton( isLoading );
+
 	return <>{ showSkeleton ? skeleton : children }</>;
 };
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/test/use-order-summary-loading-state.js b/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/test/use-order-summary-loading-state.js
index 9d1d923955f..102fd7698ad 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/test/use-order-summary-loading-state.js
+++ b/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/test/use-order-summary-loading-state.js
@@ -8,6 +8,7 @@ jest.mock( '../cart/use-store-cart-coupons', () => ( {
 } ) );

 jest.mock( '@wordpress/data', () => ( {
+	...jest.requireActual( '@wordpress/data' ),
 	useSelect: jest.fn(),
 } ) );

@@ -17,16 +18,40 @@ jest.mock( '@woocommerce/block-data', () => ( {
 	},
 } ) );

+jest.mock( '@woocommerce/base-hooks', () => {
+	const actual = jest.requireActual( '@woocommerce/base-hooks' );
+	return { ...actual, usePresence: jest.fn( actual.usePresence ) };
+} );
+
+jest.mock( '@wordpress/compose', () => {
+	const actual = jest.requireActual( '@wordpress/compose' );
+	return {
+		...actual,
+		useReducedMotion: jest.fn( actual.useReducedMotion ),
+	};
+} );
+
+jest.mock( '@woocommerce/base-utils', () => ( {
+	...jest.requireActual( '@woocommerce/base-utils' ),
+	isKeyboardInput: jest.fn( () => false ),
+} ) );
+
 /**
  * External dependencies
  */
-import { renderHook } from '@testing-library/react';
+import { usePresence } from '@woocommerce/base-hooks';
+import { isKeyboardInput } from '@woocommerce/base-utils';
+import { act, renderHook } from '@testing-library/react';
+import { useReducedMotion } from '@wordpress/compose';
 import { useSelect } from '@wordpress/data';

 /**
  * Internal dependencies
  */
-import { useOrderSummaryLoadingState } from '../use-order-summary-loading-state';
+import {
+	useOrderSummaryLoadingState,
+	useOrderSummaryRow,
+} from '../use-order-summary-loading-state';
 import { useStoreCart } from '../cart/use-store-cart';
 import { useStoreCartCoupons } from '../cart/use-store-cart-coupons';

@@ -154,3 +179,116 @@ describe( 'useOrderSummaryLoadingState', () => {
 		);
 	} );
 } );
+
+describe( 'useOrderSummaryRow', () => {
+	const mockCart = ( cartFees, isCalculating = false ) => {
+		useStoreCart.mockReturnValue( {
+			cartIsLoading: false,
+			isLoadingRates: false,
+			hasPendingItemsOperations: false,
+			cartFees,
+		} );
+		useSelect.mockReturnValue( isCalculating );
+	};
+	const renderRow = () =>
+		renderHook( () =>
+			useOrderSummaryRow(
+				useStoreCart(),
+				( { cartFees } ) => cartFees.length > 0
+			)
+		);
+
+	beforeEach( () => {
+		useStoreCartCoupons.mockReturnValue( {
+			isApplyingCoupon: false,
+			isRemovingCoupon: false,
+		} );
+	} );
+
+	afterEach( () => {
+		jest.clearAllMocks();
+	} );
+
+	it( 'returns the cart while the row shows, and null when it goes', () => {
+		mockCart( [ 'fee' ] );
+		const { result, rerender } = renderRow();
+		expect( result.current.cart.cartFees ).toEqual( [ 'fee' ] );
+
+		mockCart( [] );
+		rerender();
+		expect( result.current.cart ).toBeNull();
+		expect( result.current.wrapperProps.isExiting ).toBe( false );
+	} );
+
+	it( 'shows a new row when the skeletons end, not when the data arrives', () => {
+		mockCart( [] );
+		const { result, rerender } = renderRow();
+
+		mockCart( [ 'fee' ], true );
+		rerender();
+		expect( result.current.cart ).toBeNull();
+
+		mockCart( [ 'fee' ] );
+		rerender();
+		expect( result.current.cart.cartFees ).toEqual( [ 'fee' ] );
+	} );
+
+	it( 'is stale while the row shows a cart that is not the current one', () => {
+		mockCart( [ 'fee' ] );
+		const { result, rerender } = renderRow();
+		expect( result.current.isStale ).toBe( false );
+
+		mockCart( [], true );
+		rerender();
+		expect( result.current.cart.cartFees ).toEqual( [ 'fee' ] );
+		expect( result.current.isStale ).toBe( true );
+
+		mockCart( [ 'fee' ] );
+		rerender();
+		expect( result.current.isStale ).toBe( false );
+	} );
+
+	it( 'stays stale until the skeletons end, with motion', () => {
+		// The global mock reports reduced motion, which ends the skeletons at once.
+		useReducedMotion.mockReturnValue( false );
+		jest.useFakeTimers();
+		try {
+			mockCart( [ 'fee' ] );
+			const { result, rerender } = renderRow();
+
+			mockCart( [ 'new fee' ], true );
+			rerender();
+			mockCart( [ 'new fee' ] );
+			rerender();
+			expect( result.current.cart.cartFees ).toEqual( [ 'fee' ] );
+			expect( result.current.isStale ).toBe( true );
+
+			act( () => jest.advanceTimersByTime( 100 ) );
+			expect( result.current.isStale ).toBe( true );
+
+			act( () => jest.runOnlyPendingTimers() );
+			expect( result.current.cart.cartFees ).toEqual( [ 'new fee' ] );
+			expect( result.current.isStale ).toBe( false );
+		} finally {
+			jest.useRealTimers();
+			useReducedMotion.mockImplementation(
+				jest.requireActual( '@wordpress/compose' ).useReducedMotion
+			);
+		}
+	} );
+
+	it( 'animates after a pointer change, not after a key press', () => {
+		mockCart( [] );
+		const { rerender } = renderRow();
+		const lastAnimate = () => usePresence.mock.lastCall[ 1 ].animate;
+
+		mockCart( [ 'fee' ] );
+		rerender();
+		expect( lastAnimate() ).toBe( true );
+
+		isKeyboardInput.mockReturnValue( true );
+		rerender();
+		expect( lastAnimate() ).toBe( false );
+		isKeyboardInput.mockReturnValue( false );
+	} );
+} );
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/use-order-summary-loading-state.ts b/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/use-order-summary-loading-state.ts
index 0de6037823e..b6f4392b0ba 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/use-order-summary-loading-state.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/base/context/hooks/use-order-summary-loading-state.ts
@@ -1,8 +1,13 @@
 /**
  * External dependencies
  */
+import { useLayoutEffect, useRef } from '@wordpress/element';
 import { useSelect } from '@wordpress/data';
 import { checkoutStore } from '@woocommerce/block-data';
+import { useDelayedSkeleton } from '@woocommerce/base-components/delayed-content-with-skeleton';
+import { usePresence } from '@woocommerce/base-hooks';
+import { isKeyboardInput } from '@woocommerce/base-utils';
+import type { StoreCart } from '@woocommerce/types';

 /**
  * Internal dependencies
@@ -38,3 +43,64 @@ export const useOrderSummaryLoadingState = () => {
 		isLoading,
 	};
 };
+
+/**
+ * Returns `value` as it was before the order summary's skeletons appeared, until they end. Values that use it change
+ * at the same moment as the values behind the skeletons, not when the new data arrives.
+ */
+export const useSettledOrderSummaryValue = < T >( value: T ): T => {
+	const { isLoading } = useOrderSummaryLoadingState();
+	const showSkeleton = useDelayedSkeleton( isLoading );
+	const settled = useRef( value );
+	// Recorded after the commit, so a render that React discards never becomes the settled value.
+	useLayoutEffect( () => {
+		if ( ! showSkeleton ) {
+			settled.current = value;
+		}
+	} );
+	return showSkeleton ? settled.current : value;
+};
+
+/**
+ * For an order summary row that only shows sometimes, such as Fees. The row appears and goes when the skeletons end,
+ * with the other values. It grows in and collapses out, so the rows below and the total move with it. Rows of the
+ * cart that loads with the page, or that change after a key press, show immediately.
+ *
+ * @param storeCart The cart from `useStoreCart`.
+ * @param isShown   Whether the row shows for the settled cart.
+ * @return The settled cart to render the row from, or `null` when the row is gone. While the row collapses, it is the
+ *         last cart that the row showed. `isStale` is true while that cart is not the current one, so that the row
+ *         can disable its controls. Spread `wrapperProps` on the row's `TotalsWrapper`.
+ */
+export const useOrderSummaryRow = (
+	storeCart: StoreCart,
+	isShown: ( cart: StoreCart ) => boolean
+) => {
+	const cart = useSettledOrderSummaryValue( storeCart );
+	const shown = isShown( cart );
+	const lastShown = useRef( cart );
+	useLayoutEffect( () => {
+		if ( shown ) {
+			lastShown.current = cart;
+		}
+	} );
+	// Updated after the commit, so the render that settles the first load does not animate.
+	const wasLoaded = useRef( ! cart.cartIsLoading );
+	useLayoutEffect( () => {
+		wasLoaded.current = ! cart.cartIsLoading;
+	}, [ cart.cartIsLoading ] );
+	// A boolean, so a new cart object never counts as a change of presence.
+	const presence = usePresence( shown || null, {
+		animate: wasLoaded.current && ! isKeyboardInput(),
+		collapse: true,
+	} );
+	const rowCart = shown ? cart : lastShown.current;
+	return {
+		cart: presence.value ? rowCart : null,
+		isStale: rowCart !== storeCart,
+		wrapperProps: {
+			elementRef: presence.ref,
+			isExiting: presence.isExiting,
+		},
+	};
+};
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/utils/animate-collapse.ts b/plugins/woocommerce/client/blocks/assets/js/base/utils/animate-collapse.ts
index aa0aa9ac40e..bb1911c33bc 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/utils/animate-collapse.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/base/utils/animate-collapse.ts
@@ -10,13 +10,15 @@ const ATTRIBUTE = 'data-wc-collapse';
 // Marks the copy that `collapseCopy` puts in the place of an element, with the class name of the element.
 const COPY = 'data-wc-collapse-copy';

-// The properties that make the space, and the fade.
+// The properties that make the space, and the fade. Borders count, so a bordered row leaves no line behind.
 const PROPERTIES = [
 	'height',
 	'paddingTop',
 	'paddingBottom',
 	'marginTop',
 	'marginBottom',
+	'borderTopWidth',
+	'borderBottomWidth',
 	'opacity',
 ] as const;

@@ -28,6 +30,8 @@ const CLOSED: Values = {
 	paddingBottom: '0px',
 	marginTop: '0px',
 	marginBottom: '0px',
+	borderTopWidth: '0px',
+	borderBottomWidth: '0px',
 	opacity: '0',
 };

diff --git a/plugins/woocommerce/client/blocks/assets/js/base/utils/index.js b/plugins/woocommerce/client/blocks/assets/js/base/utils/index.js
index 3736468c64d..f42a66b8c92 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/utils/index.js
+++ b/plugins/woocommerce/client/blocks/assets/js/base/utils/index.js
@@ -20,3 +20,4 @@ export * from './get-inline-styles';
 export * from './use-return-focus';
 export * from './when-animations-end';
 export * from './animate-collapse';
+export * from './input-modality';
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/utils/input-modality.ts b/plugins/woocommerce/client/blocks/assets/js/base/utils/input-modality.ts
new file mode 100644
index 00000000000..8bcaa8e4b9e
--- /dev/null
+++ b/plugins/woocommerce/client/blocks/assets/js/base/utils/input-modality.ts
@@ -0,0 +1,17 @@
+// Each script bundle has its own copy of this module, and so its own listeners. They all see the same events.
+let wasKeyPress = false;
+
+if ( typeof document !== 'undefined' ) {
+	document.addEventListener( 'keydown', () => ( wasKeyPress = true ), true );
+	document.addEventListener(
+		'pointerdown',
+		() => ( wasKeyPress = false ),
+		true
+	);
+}
+
+/**
+ * Whether the shopper's last input was a key press, such as Enter to apply a coupon, rather than a click or a tap.
+ * Content that a key press shows or hides applies at once, without motion.
+ */
+export const isKeyboardInput = (): boolean => wasKeyPress;
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/utils/test/animate-collapse.ts b/plugins/woocommerce/client/blocks/assets/js/base/utils/test/animate-collapse.ts
index f1481e9a726..27cd704810a 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/utils/test/animate-collapse.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/base/utils/test/animate-collapse.ts
@@ -9,6 +9,8 @@ const NATURAL: Record< string, string > = {
 	paddingBottom: '0px',
 	marginTop: '16px',
 	marginBottom: '0px',
+	borderTopWidth: '1px',
+	borderBottomWidth: '0px',
 	opacity: '1',
 };

diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.tsx
index 3c189b7d33f..ebc20ddef30 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.tsx
@@ -8,6 +8,7 @@ import {
 	useStoreCartCoupons,
 	useStoreCart,
 	useOrderSummaryLoadingState,
+	useOrderSummaryRow,
 } from '@woocommerce/base-context/hooks';
 import { ExperimentalDiscountsMeta } from '@woocommerce/blocks-checkout';

@@ -24,30 +25,32 @@ const DiscountSlotFill = (): JSX.Element => {
 	return <ExperimentalDiscountsMeta.Slot { ...discountsSlotFillProps } />;
 };

-const Block = ( { className }: { className: string } ) => {
-	const { cartTotals, cartCoupons } = useStoreCart();
+const Block = ( { className }: { className: string } ): JSX.Element => {
+	const { cart, isStale, wrapperProps } = useOrderSummaryRow(
+		useStoreCart(),
+		( { cartCoupons } ) => cartCoupons.length > 0
+	);
 	const { removeCoupon, isRemovingCoupon } = useStoreCartCoupons( 'wc/cart' );
 	const { isLoading } = useOrderSummaryLoadingState();

-	// Hide all but the slot/fill if there are no coupons to show.
-	if ( ! cartCoupons.length ) {
-		return <DiscountSlotFill />;
-	}
-
-	const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
-
 	return (
 		<>
-			<TotalsWrapper className={ className }>
-				<TotalsDiscount
-					cartCoupons={ cartCoupons }
-					currency={ totalsCurrency }
-					isRemovingCoupon={ isRemovingCoupon }
-					removeCoupon={ removeCoupon }
-					values={ cartTotals }
-					isLoading={ isLoading }
-				/>
-			</TotalsWrapper>
+			{ /* Kept before the slot, so the slot stays mounted and its fills keep their state. */ }
+			{ cart && (
+				<TotalsWrapper className={ className } { ...wrapperProps }>
+					<TotalsDiscount
+						cartCoupons={ cart.cartCoupons }
+						currency={ getCurrencyFromPriceResponse(
+							cart.cartTotals
+						) }
+						isRemovingCoupon={ isRemovingCoupon }
+						removeCoupon={ removeCoupon }
+						values={ cart.cartTotals }
+						isLoading={ isLoading }
+						disabled={ isStale }
+					/>
+				</TotalsWrapper>
+			) }
 			<DiscountSlotFill />
 		</>
 	);
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/test/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/test/block.tsx
index 0de4e6c4d22..13a54aacd89 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/test/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/test/block.tsx
@@ -22,6 +22,13 @@ jest.mock( '@woocommerce/base-context/hooks', () => ( {
 			isLoading: false,
 		};
 	} ),
+	// Shows the row at once, as without motion.
+	useOrderSummaryRow: jest.fn(
+		( cart: unknown, isShown: ( settledCart: unknown ) => boolean ) => ( {
+			cart: isShown( cart ) ? cart : null,
+			wrapperProps: {},
+		} )
+	),
 } ) );

 // Mock the ExperimentalDiscountsMeta to track when slot is rendered
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.tsx
index 6412fe4901a..1f435d7d3ac 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.tsx
@@ -3,21 +3,30 @@
  */
 import { TotalsFees, TotalsWrapper } from '@woocommerce/blocks-components';
 import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
-import { useStoreCart } from '@woocommerce/base-context/hooks';
+import {
+	useStoreCart,
+	useOrderSummaryRow,
+} from '@woocommerce/base-context/hooks';

 const Block = ( { className }: { className: string } ) => {
-	const { cartFees, cartTotals } = useStoreCart();
+	const { cart, wrapperProps } = useOrderSummaryRow(
+		useStoreCart(),
+		( { cartFees } ) => cartFees.length > 0
+	);

 	// Hide if there are no fees to show.
-	if ( ! cartFees.length ) {
+	if ( ! cart ) {
 		return null;
 	}

-	const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
+	const totalsCurrency = getCurrencyFromPriceResponse( cart.cartTotals );

 	return (
-		<TotalsWrapper className={ className }>
-			<TotalsFees currency={ totalsCurrency } cartFees={ cartFees } />
+		<TotalsWrapper className={ className } { ...wrapperProps }>
+			<TotalsFees
+				currency={ totalsCurrency }
+				cartFees={ cart.cartFees }
+			/>
 		</TotalsWrapper>
 	);
 };
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.tsx
index 2977843e454..e2876215802 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.tsx
@@ -6,28 +6,31 @@ import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
 import {
 	useStoreCart,
 	useOrderSummaryLoadingState,
+	useOrderSummaryRow,
 } from '@woocommerce/base-context/hooks';

 const Block = ( { className = '' }: { className?: string } ) => {
-	const { cartTotals } = useStoreCart();
 	const { isLoading } = useOrderSummaryLoadingState();
+	// Shown only when there are other totals to show, so it grows and collapses with them.
+	const { cart, wrapperProps } = useOrderSummaryRow(
+		useStoreCart(),
+		( { cartTotals } ) =>
+			!! parseFloat( cartTotals.total_fees ) ||
+			!! parseFloat( cartTotals.total_discount ) ||
+			!! parseFloat( cartTotals.total_shipping )
+	);

-	// Hide if there are no other totals to show.
-	if (
-		! parseFloat( cartTotals.total_fees ) &&
-		! parseFloat( cartTotals.total_discount ) &&
-		! parseFloat( cartTotals.total_shipping )
-	) {
+	if ( ! cart ) {
 		return null;
 	}

-	const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
+	const totalsCurrency = getCurrencyFromPriceResponse( cart.cartTotals );

 	return (
-		<TotalsWrapper className={ className }>
+		<TotalsWrapper className={ className } { ...wrapperProps }>
 			<Subtotal
 				currency={ totalsCurrency }
-				values={ cartTotals }
+				values={ cart.cartTotals }
 				showSkeleton={ isLoading }
 			/>
 		</TotalsWrapper>
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.tsx
index a0ce3333ff9..54b91a56e35 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.tsx
@@ -6,6 +6,7 @@ import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
 import {
 	useStoreCart,
 	useOrderSummaryLoadingState,
+	useOrderSummaryRow,
 } from '@woocommerce/base-context';
 import { getSetting } from '@woocommerce/settings';

@@ -16,29 +17,26 @@ const Block = ( {
 	className: string;
 	showRateAfterTaxName: boolean;
 } ) => {
-	const { cartTotals } = useStoreCart();
 	const { isLoading } = useOrderSummaryLoadingState();
-
-	const displayCartPricesIncludingTax = getSetting(
-		'displayCartPricesIncludingTax',
-		false
+	const { cart, wrapperProps } = useOrderSummaryRow(
+		useStoreCart(),
+		( { cartTotals } ) =>
+			! getSetting( 'displayCartPricesIncludingTax', false ) &&
+			parseInt( cartTotals.total_tax, 10 ) > 0
 	);

-	if (
-		displayCartPricesIncludingTax ||
-		parseInt( cartTotals.total_tax, 10 ) <= 0
-	) {
+	if ( ! cart ) {
 		return null;
 	}

-	const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
+	const totalsCurrency = getCurrencyFromPriceResponse( cart.cartTotals );

 	return (
-		<TotalsWrapper className={ className }>
+		<TotalsWrapper className={ className } { ...wrapperProps }>
 			<TotalsTaxes
 				showRateAfterTaxName={ showRateAfterTaxName }
 				currency={ totalsCurrency }
-				values={ cartTotals }
+				values={ cart.cartTotals }
 				showSkeleton={ isLoading }
 			/>
 		</TotalsWrapper>
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx
index 6d7b2044e22..0c2234be668 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx
@@ -8,8 +8,14 @@ import {
 	useStoreCartCoupons,
 	useStoreCart,
 	useOrderSummaryLoadingState,
+	useOrderSummaryRow,
 } from '@woocommerce/base-context/hooks';
-import { ExperimentalDiscountsMeta } from '@woocommerce/blocks-checkout';
+import {
+	ExperimentalDiscountsMeta,
+	applyCheckoutFilter,
+} from '@woocommerce/blocks-checkout';
+
+const couponsFilterArg = { context: 'summary' };

 const DiscountSlotFill = (): JSX.Element => {
 	// Prepare props to pass to the ExperimentalOrderMeta slot fill. We need to pluck out receiveCart.
@@ -25,24 +31,39 @@ const DiscountSlotFill = (): JSX.Element => {
 };

 const Block = ( { className = '' }: { className?: string } ): JSX.Element => {
-	const { cartTotals, cartCoupons } = useStoreCart();
+	const { cart, isStale, wrapperProps } = useOrderSummaryRow(
+		useStoreCart(),
+		// Matches `TotalsDiscount`, so coupons that a `coupons` filter adds still show.
+		( { cartCoupons, cartTotals } ) =>
+			!! parseInt( cartTotals.total_discount, 10 ) ||
+			applyCheckoutFilter( {
+				arg: couponsFilterArg,
+				filterName: 'coupons',
+				defaultValue: cartCoupons,
+			} ).length > 0
+	);
 	const { removeCoupon, isRemovingCoupon } =
 		useStoreCartCoupons( 'wc/checkout' );
 	const { isLoading } = useOrderSummaryLoadingState();
-	const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );

 	return (
 		<>
-			<TotalsWrapper className={ className }>
-				<TotalsDiscount
-					cartCoupons={ cartCoupons }
-					currency={ totalsCurrency }
-					isRemovingCoupon={ isRemovingCoupon }
-					removeCoupon={ removeCoupon }
-					values={ cartTotals }
-					isLoading={ isLoading }
-				/>
-			</TotalsWrapper>
+			{ /* Kept before the slot, so the slot stays mounted and its fills keep their state. */ }
+			{ cart && (
+				<TotalsWrapper className={ className } { ...wrapperProps }>
+					<TotalsDiscount
+						cartCoupons={ cart.cartCoupons }
+						currency={ getCurrencyFromPriceResponse(
+							cart.cartTotals
+						) }
+						isRemovingCoupon={ isRemovingCoupon }
+						removeCoupon={ removeCoupon }
+						values={ cart.cartTotals }
+						isLoading={ isLoading }
+						disabled={ isStale }
+					/>
+				</TotalsWrapper>
+			) }
 			<DiscountSlotFill />
 		</>
 	);
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/test/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/test/block.tsx
index 7aa188154bd..68ceb3bace7 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/test/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/test/block.tsx
@@ -3,6 +3,7 @@
  */
 import { render, screen } from '@testing-library/react';
 import { useStoreCart } from '@woocommerce/base-context/hooks';
+import { applyCheckoutFilter } from '@woocommerce/blocks-checkout';

 /**
  * Internal dependencies
@@ -16,6 +17,13 @@ jest.mock( '@woocommerce/base-context/hooks', () => ( {
 		isRemovingCoupon: false,
 	} ) ),
 	useOrderSummaryLoadingState: jest.fn( () => ( { isLoading: false } ) ),
+	// Shows the row at once, as without motion.
+	useOrderSummaryRow: jest.fn(
+		( cart: unknown, isShown: ( settledCart: unknown ) => boolean ) => ( {
+			cart: isShown( cart ) ? cart : null,
+			wrapperProps: {},
+		} )
+	),
 } ) );

 const mockSlotRender = jest.fn( () => <div data-testid="discount-slot" /> );
@@ -94,4 +102,45 @@ describe( 'Checkout Order Summary Discount Block', () => {

 		expect( screen.getByTestId( 'discount-slot' ) ).toBeInTheDocument();
 	} );
+
+	it( 'shows coupons that the coupons filter adds when the cart has none', () => {
+		( applyCheckoutFilter as jest.Mock ).mockImplementation(
+			( { filterName, defaultValue } ) =>
+				filterName === 'coupons'
+					? [
+							{
+								code: 'extension-coupon',
+								label: 'EXTENSION',
+								totals: {
+									total_discount: '0',
+									total_discount_tax: '0',
+								},
+							},
+						]
+					: defaultValue
+		);
+
+		render( <Block /> );
+
+		expect( screen.getByText( 'EXTENSION' ) ).toBeInTheDocument();
+	} );
+
+	it( 'keeps the DiscountsMeta slot mounted when the discount row appears', () => {
+		( applyCheckoutFilter as jest.Mock ).mockImplementation(
+			( { defaultValue } ) => defaultValue
+		);
+		const { rerender } = render( <Block /> );
+		const slot = screen.getByTestId( 'discount-slot' );
+
+		( useStoreCart as jest.Mock ).mockReturnValue( {
+			...mockCartData,
+			cartTotals: {
+				...mockCartData.cartTotals,
+				total_discount: '1000',
+			},
+		} );
+		rerender( <Block /> );
+
+		expect( screen.getByTestId( 'discount-slot' ) ).toBe( slot );
+	} );
 } );
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.tsx
index ce92817ebc8..b384537d0a7 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.tsx
@@ -3,15 +3,34 @@
  */
 import { TotalsFees, TotalsWrapper } from '@woocommerce/blocks-components';
 import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
-import { useStoreCart } from '@woocommerce/base-context/hooks';
+import {
+	useStoreCart,
+	useOrderSummaryRow,
+} from '@woocommerce/base-context/hooks';

-const Block = ( { className = '' }: { className?: string } ): JSX.Element => {
-	const { cartFees, cartTotals } = useStoreCart();
-	const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
+const Block = ( {
+	className = '',
+}: {
+	className?: string;
+} ): JSX.Element | null => {
+	const { cart, wrapperProps } = useOrderSummaryRow(
+		useStoreCart(),
+		( { cartFees } ) => cartFees.length > 0
+	);
+
+	// Hide if there are no fees to show.
+	if ( ! cart ) {
+		return null;
+	}
+
+	const totalsCurrency = getCurrencyFromPriceResponse( cart.cartTotals );

 	return (
-		<TotalsWrapper className={ className }>
-			<TotalsFees currency={ totalsCurrency } cartFees={ cartFees } />
+		<TotalsWrapper className={ className } { ...wrapperProps }>
+			<TotalsFees
+				currency={ totalsCurrency }
+				cartFees={ cart.cartFees }
+			/>
 		</TotalsWrapper>
 	);
 };
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.tsx b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.tsx
index 49dd6fda05c..d33f6073127 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.tsx
@@ -6,6 +6,7 @@ import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
 import {
 	useStoreCart,
 	useOrderSummaryLoadingState,
+	useOrderSummaryRow,
 } from '@woocommerce/base-context';
 import { getSetting } from '@woocommerce/settings';

@@ -16,28 +17,26 @@ const Block = ( {
 	className: string;
 	showRateAfterTaxName: boolean;
 } ): JSX.Element | null => {
-	const { cartTotals } = useStoreCart();
 	const { isLoading } = useOrderSummaryLoadingState();
-	const displayCartPricesIncludingTax = getSetting(
-		'displayCartPricesIncludingTax',
-		false
+	const { cart, wrapperProps } = useOrderSummaryRow(
+		useStoreCart(),
+		( { cartTotals } ) =>
+			! getSetting( 'displayCartPricesIncludingTax', false ) &&
+			parseInt( cartTotals.total_tax, 10 ) > 0
 	);

-	if (
-		displayCartPricesIncludingTax ||
-		parseInt( cartTotals.total_tax, 10 ) <= 0
-	) {
+	if ( ! cart ) {
 		return null;
 	}

-	const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
+	const totalsCurrency = getCurrencyFromPriceResponse( cart.cartTotals );

 	return (
-		<TotalsWrapper className={ className }>
+		<TotalsWrapper className={ className } { ...wrapperProps }>
 			<TotalsTaxes
 				showRateAfterTaxName={ showRateAfterTaxName }
 				currency={ totalsCurrency }
-				values={ cartTotals }
+				values={ cart.cartTotals }
 				showSkeleton={ isLoading }
 			/>
 		</TotalsWrapper>
diff --git a/plugins/woocommerce/client/blocks/docs/contributors/motion.md b/plugins/woocommerce/client/blocks/docs/contributors/motion.md
index c97c2371cb0..df3c10b8075 100644
--- a/plugins/woocommerce/client/blocks/docs/contributors/motion.md
+++ b/plugins/woocommerce/client/blocks/docs/contributors/motion.md
@@ -96,6 +96,7 @@ Motion that changes the layout runs in JavaScript, because it must measure sizes
 | `animateCollapse( element, isOpen, animate, from )` (`@woocommerce/base-utils`) | Grows `element` open or collapses it shut in the real layout, and turns around if it still moves. Give `element` the `motion-collapse` mixin. Use it through `usePresence` when the component owns the content. Pass `from`, such as `{ height: '20px' }`, to grow from the size of the content that `element` replaces, or to change the height of an element that stays. |
 | `collapseCopy( element )` (`@woocommerce/base-utils`) | Collapses an inert copy of `element` in its place, so that `element` can unmount at once. Call it just before `element` unmounts. If `element` grows again first, it grows from the copy. |
 | `useToggleCollapse( isShown, getElement, { growFromTrigger } )` (`@woocommerce/base-hooks`) | Content that a control shows and hides, such as a checkbox that reveals a field. Call the `onToggle` that it returns in the handler of the control, before the state changes. Pass it the click event if there is one, or else put `triggerRef` on the control. `getElement` must not return the copy, which keeps the element's classes: find the element by id, or skip `[data-wc-collapse-copy]`. After a click, the element grows in, or an inert copy of it collapses while the real element unmounts. After a key press, the change applies immediately. Pass `growFromTrigger: true` when the content replaces the control, to grow from the height of the control. |
+| `useOrderSummaryRow( cart, isShown )` (`@woocommerce/base-context/hooks`) | An order summary row that only shows sometimes, such as Fees. The row appears and goes when the skeletons end, and grows and collapses through `usePresence`. Rows of the cart that loads with the page show immediately. It returns `{ cart, isStale, wrapperProps }`. Render the row from `cart` while it is not `null`, and spread `wrapperProps` on its `TotalsWrapper`. `isStale` is true while `cart` is not the current cart, so disable controls in the row then. |

 ## Techniques

@@ -118,7 +119,7 @@ Find the change in this table, and use the helpers above.
 | An element becomes a different view of itself, such as an address card that becomes its form | The two views crossfade while the height changes. |
 | A table row goes | It fades in place, and the rows below slide up. |

-Real layout means the element's height, padding, and margins change, so theme borders, spacing, and extension markup move with it. Use `transform` for everything else.
+Real layout means the element's height, padding, borders, and margins change, so theme spacing and extension markup move with it. Use `transform` for everything else.

 ## Test motion

diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/index.tsx b/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/index.tsx
index eff8dd7b21d..8ad11d18a97 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/index.tsx
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/index.tsx
@@ -3,7 +3,8 @@
  */
 import clsx from 'clsx';
 import { Children } from '@wordpress/element';
-import type { ReactNode } from 'react';
+import { exitingProps } from '@woocommerce/base-hooks';
+import type { ReactNode, Ref } from 'react';

 /**
  * Internal dependencies
@@ -15,18 +16,26 @@ export interface TotalsWrapperProps {
 	/* If this TotalsWrapper is being used to wrap a Slot */
 	slotWrapper?: boolean;
 	className?: string;
+	/* A ref to the wrapper element, such as for motion. */
+	elementRef?: Ref< HTMLDivElement >;
+	/* Set while the row animates out. The row is inert and hidden from assistive technology. */
+	isExiting?: boolean;
 }

 const TotalsWrapper = ( {
 	children,
 	slotWrapper = false,
 	className,
+	elementRef,
+	isExiting = false,
 }: TotalsWrapperProps ): JSX.Element | null => {
 	return Children.count( children ) ? (
 		<div
+			ref={ elementRef }
 			className={ clsx( className, 'wc-block-components-totals-wrapper', {
 				'slot-wrapper': slotWrapper,
 			} ) }
+			{ ...exitingProps( isExiting ) }
 		>
 			{ children }
 		</div>
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/style.scss b/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/style.scss
index b9fe104d460..a22481751e4 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/style.scss
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/totals-wrapper/style.scss
@@ -34,3 +34,8 @@
 		}
 	}
 }
+
+// Only the blocks that use motion animate the rows that appear and go.
+:where(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-wrapper {
+	@include motion-collapse;
+}