diff --git a/assets/js/blocks/cart-checkout/cart/edit.js b/assets/js/blocks/cart-checkout/cart/edit.js index cb9ddca350e..933f6af1169 100644 --- a/assets/js/blocks/cart-checkout/cart/edit.js +++ b/assets/js/blocks/cart-checkout/cart/edit.js @@ -168,7 +168,7 @@ export const Edit = ( { className, attributes, setAttributes, clientId } ) => { diff --git a/assets/js/blocks/cart-checkout/cart/index.js b/assets/js/blocks/cart-checkout/cart/index.js index b4db7743c9e..b2c15167434 100644 --- a/assets/js/blocks/cart-checkout/cart/index.js +++ b/assets/js/blocks/cart-checkout/cart/index.js @@ -3,9 +3,10 @@ */ import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; +import { InnerBlocks } from '@wordpress/block-editor'; import { Icon, cart } from '@woocommerce/icons'; import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; - +import { createBlock } from '@wordpress/blocks'; /** * Internal dependencies */ @@ -43,15 +44,34 @@ const settings = { // Migrates v1 to v2 checkout. deprecated: [ { - attributes: blockAttributes, - save( { attributes } ) { + save: ( { attributes } ) => { return (
+ > + +
+ ); + }, + migrate: ( attributes, innerBlocks ) => { + return [ + attributes, + [ + createBlock( 'woocommerce/filled-cart-block' ), + createBlock( + 'woocommerce/empty-cart-block', + {}, + innerBlocks + ), + ], + ]; + }, + isEligible: ( _, innerBlocks ) => { + return ! innerBlocks.find( + ( block ) => block.name === 'woocommerce/filled-cart-block' ); }, },