Skip to content

Filter "product_type_selector" should be applied everywhere, not only in admin area #407

@axi

Description

@axi

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:

$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:

$products = wc_get_products(['type' => ["accommodation-booking"]]);

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


  • Issue assigned to next milestone.
  • Issue assigned a priority (will be assessed by maintainers).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions