Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
axi opened this issue Jan 25, 2024 · 0 comments
Open
2 tasks
Labels
priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement. type: technical debt This issue/PR represents/solves the technical debt of the project.

Comments

@axi
Copy link

axi commented Jan 25, 2024

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).
@vikrampm1 vikrampm1 added priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement. labels Jan 26, 2024
@jeffpaul jeffpaul added the type: technical debt This issue/PR represents/solves the technical debt of the project. label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low The issue/PR is low priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement. type: technical debt This issue/PR represents/solves the technical debt of the project.
Projects
None yet
Development

No branches or pull requests

3 participants