I use recommanded way to get products on a custom template: WC_Product_Query/ wc_get_products(), following the good practice from here.
I'm expecting to get all my products with default params:
$products = wc_get_products();
but $products is empty.
I tracked it down to the filter 'product_type_selector' (adding type 'accommodation-booking', see method WC_Accommodation_Booking_Admin_Panels::product_type_selector()) not being applied when not on admin area.
So wc_get_product_types() does not include 'accommodation-booking' and I'm forced to specify the type in query to get my products:
Maybe I don't get the complete picture but I guess this 'product_type_selector' filter should be called on plugin loading.
PS: same thing for booking plugin
[ ] Issue assigned to next milestone.
[ ] Issue assigned a priority (will be assessed by maintainers).
What I expected
I use recommanded way to get products on a custom template:
WC_Product_Query
/wc_get_products()
, following the good practice from here.I'm expecting to get all my products with default params:
but
$products
is empty.I tracked it down to the filter
'product_type_selector'
(adding type'accommodation-booking'
, see methodWC_Accommodation_Booking_Admin_Panels::product_type_selector()
) not being applied when not on admin area.So
wc_get_product_types()
does not include'accommodation-booking'
and I'm forced to specify the type in query to get my products:Suggestion
Maybe I don't get the complete picture but I guess this
'product_type_selector'
filter should be called on plugin loading. PS: same thing for booking plugin