diff --git a/plugins/woocommerce-blocks/assets/js/products-block.js b/plugins/woocommerce-blocks/assets/js/products-block.js index 5e80469c2c2..ba5f7184cdd 100644 --- a/plugins/woocommerce-blocks/assets/js/products-block.js +++ b/plugins/woocommerce-blocks/assets/js/products-block.js @@ -669,7 +669,7 @@ registerBlockType('woocommerce/products', { */ rows: { type: 'number', - default: 1 + default: wc_product_block_data.default_rows }, /** @@ -786,8 +786,8 @@ registerBlockType('woocommerce/products', { onChange: function onChange(value) { return setAttributes({ rows: value }); }, - min: 1, - max: 6 + min: wc_product_block_data.min_rows, + max: wc_product_block_data.max_rows }), orderControl ); diff --git a/plugins/woocommerce-blocks/assets/js/products-block.jsx b/plugins/woocommerce-blocks/assets/js/products-block.jsx index ac7709be143..1b381c99370 100644 --- a/plugins/woocommerce-blocks/assets/js/products-block.jsx +++ b/plugins/woocommerce-blocks/assets/js/products-block.jsx @@ -414,7 +414,7 @@ registerBlockType( 'woocommerce/products', { */ rows: { type: 'number', - default: 1, + default: wc_product_block_data.default_rows, }, /** @@ -521,8 +521,8 @@ registerBlockType( 'woocommerce/products', { label={ __( 'Rows' ) } value={ rows } onChange={ ( value ) => setAttributes( { rows: value } ) } - min={ 1 } - max={ 6 } + min={ wc_product_block_data.min_rows } + max={ wc_product_block_data.max_rows } /> { orderControl } diff --git a/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php b/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php index 475c910ab57..be5382759bd 100644 --- a/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php +++ b/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php @@ -37,6 +37,9 @@ function wgpb_register_products_block() { 'min_columns' => wc_get_theme_support( 'product_grid::min_columns', 1 ), 'max_columns' => wc_get_theme_support( 'product_grid::max_columns', 6 ), 'default_columns' => wc_get_default_products_per_row(), + 'min_rows' => wc_get_theme_support( 'product_grid::min_rows', 1 ), + 'max_rows' => wc_get_theme_support( 'product_grid::max_rows', 6 ), + 'default_rows' => wc_get_default_product_rows_per_page(), ); wp_localize_script( 'woocommerce-products-block-editor', 'wc_product_block_data', $product_block_data );