Price filter does not show in shop page
Question
I wrote a custom theme for woocommerce and when I put the price filter in the sidebar, it does not show up. Every other filter shows up and works correctly like attributes. But the price filter does not.
I get this error:
Notice: Trying to get property of non-object in G:MAMPhtdocswpwp-contentpluginswoocommerceincludeswidgetsclass-wc-widget-price-filter.php on line 77
This is the code in line 77:
// If there are not posts and we're not filtering, hide the widget.
if ( ! WC()->query->get_main_query()->post_count && ! isset( $_GET['min_price'] ) && ! isset( $_GET['max_price'] ) ) { // WPCS: input var ok, CSRF ok.
return;
}
I know that the woocommerce uses the page template for showing the shop page and when I convert to another theme like storefront
, the price filter works correctly. There is nothing wrong in my page.php
file and the other contents just look fine in it.
0
2 months
0 Answers
10 views
0
Leave an answer
You must login or register to add a new answer .