diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-gallery/utils.tsx b/plugins/woocommerce-blocks/assets/js/blocks/product-gallery/utils.tsx index d636400ead7..eb2e15258b2 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/product-gallery/utils.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/product-gallery/utils.tsx @@ -140,6 +140,10 @@ export const moveInnerBlocksToPosition = ( const productGalleryBlock = getBlock( clientId ); if ( productGalleryBlock ) { + const previousLayout = productGalleryBlock.innerBlocks.length + ? productGalleryBlock.innerBlocks[ 0 ].attributes.layout + : null; + const thumbnailsBlock = findBlock( { blocks: [ productGalleryBlock ], findCondition( block ) { @@ -182,6 +186,22 @@ export const moveInnerBlocksToPosition = ( clientId ); + setGroupBlockLayoutByThumbnailsPosition( + thumbnailsPosition, + productGalleryBlock.innerBlocks[ 0 ].clientId + ); + + if ( previousLayout ) { + const orientation = + getGroupLayoutAttributes( thumbnailsPosition ).orientation; + updateBlockAttributes( + { + layout: { ...previousLayout, orientation }, + }, + productGalleryBlock.innerBlocks[ 0 ] + ); + } + if ( ( ( thumbnailsPosition === 'bottom' || thumbnailsPosition === 'right' ) &&