diff --git a/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/deprecated.js b/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/deprecated.js index 5a5aadbf684..48e118f3c60 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/deprecated.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/deprecated.js @@ -33,4 +33,32 @@ const v1 = { }, }; -export default [ v1 ]; +const v2 = { + attributes: Object.assign( {}, attributeDefinitions, { + rows: { type: 'number', default: 1 }, + } ), + save( { attributes } ) { + const dataAttributes = {}; + Object.keys( attributes ) + .sort() + .forEach( ( key ) => { + dataAttributes[ key ] = attributes[ key ]; + } ); + const data = { + 'data-attributes': JSON.stringify( dataAttributes ), + }; + return ( +
+ +
+ ); + }, +}; + +export default [ v2, v1 ]; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/save.js b/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/save.js index 108ae322d63..6f620e64e97 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/save.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/save.js @@ -9,22 +9,12 @@ import { InnerBlocks } from '@wordpress/block-editor'; import { getBlockClassName } from '../utils.js'; export default function save( { attributes } ) { - const dataAttributes = {}; - Object.keys( attributes ) - .sort() - .forEach( ( key ) => { - dataAttributes[ key ] = attributes[ key ]; - } ); - const data = { - 'data-attributes': JSON.stringify( dataAttributes ), - }; return (