Added Hand-Picked Collection Handler

This commit is contained in:
Christopher Allford 2024-09-18 17:08:01 -07:00
parent f1cb75592f
commit bc291f9518
No known key found for this signature in database
GPG Key ID: 80E44C778F08A88E
1 changed files with 12 additions and 0 deletions

View File

@ -1829,6 +1829,18 @@ class ProductCollection extends AbstractBlock {
* Registers any handlers for the core collections.
*/
protected function register_core_collections() {
$this->register_collection_handlers(
'woocommerce/product-collection/hand-picked',
function ( $collection_args, $common_query_values, $query ) {
// Hand-picked product collections should hide the results if no products are selected.
if ( empty( $query['handpicked_products'] ) ) {
return array(
'post__in' => array( -1 ),
);
}
}
);
$this->register_collection_handlers(
'woocommerce/product-collection/related',
function ( $collection_args ) {