diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-template/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/product-template/edit.tsx index ad8605df27b..b92ee0cb185 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/product-template/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/product-template/edit.tsx @@ -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 ), }; diff --git a/plugins/woocommerce/changelog/47537-fix-47536-product-collection-out-of-stock-products-still-visible-despite-hide-out-of-stock-items-setting b/plugins/woocommerce/changelog/47537-fix-47536-product-collection-out-of-stock-products-still-visible-despite-hide-out-of-stock-items-setting new file mode 100644 index 00000000000..51933fa9dff --- /dev/null +++ b/plugins/woocommerce/changelog/47537-fix-47536-product-collection-out-of-stock-products-still-visible-despite-hide-out-of-stock-items-setting @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix: Product Collection Block Respects 'Out of stock visibility' Setting \ No newline at end of file