Home › Forums › WoodMart support forum › Price filter for variations
Price filter for variations
- This topic has 6 replies, 2 voices, and was last updated 4 years, 11 months ago by Artem Temos.
-
AuthorPosts
-
December 14, 2019 at 5:54 pm #163392
loferParticipantThe price filter on products and variations is done by querying the wc_product_meta_lookup table, but the post_type ‘product’ in this table are priced NULL, only variations are priced. This returns min (minimum_price) and maximum (maximum_price) NULL and the price filter does not appear.
In your code the queries are for post_type = ‘product’ do you get a solution for the filters and the results are about variation?
Thank you.
December 15, 2019 at 11:16 am #163441
loferParticipantPlease see this link:
https://stackoverflow.com/questions/49342704/product-variation-wp-query-with-a-product-category-in-woocommerceHERE: Important Notes on Product Variations:
Product categories (or product tags) are not handled by product variations, but by the parent variable product.Thus, in queries to the wc_product_meta_lookup table your are looking for IDs (wp_posts.ID) that are in certain categories (table wp_term_relationships), but you should also search (wp_posts.ID) whose post_parent were also in these categories (variations are not related to categories, but parents yes)
This happens in the class-widget-price-filter.php file (when calculate price range for filter (min and max), but also should look for classes that return searches.
I would like to resolve this as soon as possible, because is a important issue.
Thank you.
December 15, 2019 at 12:26 pm #163442
Artem TemosKeymasterHello,
We use code from the WooCommerce core widget for the price filter. Check how it works with a default theme and WooCommerce widget to see if it is our theme issue or core WooCommerce problem.
Kind Regards
December 15, 2019 at 6:09 pm #163475
loferParticipantThanks I already changed the queries to include in the variations and it works. This is a problem that should be corrected in the future, assuming that variations have different prices, the current filter does not work.
December 16, 2019 at 7:00 am #163521
Artem TemosKeymasterDo you mean that this problem is with our theme’s price filter only or it is a general WooCommerce issue?
December 16, 2019 at 2:12 pm #163591
loferParticipantFrom what I found, it’s a problem with woocommerce, not your theme.
It’s simple, when querying the lookup table, it looks for IDs that are related to taxonomies, but variations (product_variation) are never related to taxonomies (but rather product), so they never appear as a result of the query.
Thank you.
December 16, 2019 at 11:13 pm #163594
Artem TemosKeymasterOK, thank you. In this situation, we suggest you to report this issue on WooCommerce github and if there is some bug, they will fix in the update.
-
AuthorPosts
Tagged: price filter, variations
- You must be logged in to create new topics. Login / Register