Fix: Product Collection block should respects 'Out of stock visibility' setting (#47537)
* Fix: Ensure Product Collection Block Respects "Hide Out of Stock Items" Setting - Added logic to include the "Out of stock visibility" setting in the Product Collection block. - Modified `ProductTemplateEdit` component to use the `getDefaultStockStatuses` function. - Ensured that out-of-stock products are hidden in the Product Collection block when the "Hide out of stock items from the catalog" option is enabled. * Add changefile(s) from automation for the following project(s): woocommerce-blocks --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
4374617d43
commit
3a3a386e34
|
@ -27,6 +27,7 @@ import type { BlockEditProps, BlockInstance } from '@wordpress/blocks';
|
|||
*/
|
||||
import { useGetLocation, useProductCollectionQueryContext } from './utils';
|
||||
import './editor.scss';
|
||||
import { getDefaultStockStatuses } from '../product-collection/constants';
|
||||
|
||||
const DEFAULT_QUERY_CONTEXT_ATTRIBUTES = [ 'collection' ];
|
||||
|
||||
|
@ -251,6 +252,14 @@ const ProductTemplateEdit = (
|
|||
location,
|
||||
productCollectionQueryContext,
|
||||
previewState: __privateProductCollectionPreviewState,
|
||||
/**
|
||||
* Use value of "Out of stock visibility" setting to determine
|
||||
* which stock statuses to include if inherit query
|
||||
* from template is true.
|
||||
*/
|
||||
...( inherit && {
|
||||
woocommerceStockStatus: getDefaultStockStatuses(),
|
||||
} ),
|
||||
} ),
|
||||
blocks: getBlocks( clientId ),
|
||||
};
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix: Product Collection Block Respects 'Out of stock visibility' Setting
|
Loading…
Reference in New Issue