Use theme default number of rows
This commit is contained in:
parent
55054fcd02
commit
d5dbda0d9f
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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 }
|
||||
</InspectorControls>
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue