Layered Nav widget hide empty atributes
-
Hello,
I’d like to hide empty attributes from Layered Nav widget.
Please see here for example. I have too many emptry attributes showing up.
How can i get this resolved?
Thanks,
Hoil
-
Can you try another theme? We hide empty by default right here https://github.com/woothemes/woocommerce/blob/master/includes/widgets/class-wc-widget-layered-nav.php#L126
Thanks, I’ll try another theme and see what happens.
But I mainly want to keep using my theme and hide the empty attributes.I’m currently using WooCommerce Storefront child theme (Outlet), mainly because I thought it would work best with WooCommerce.
If it turns out to be a theme issue, I guess I’ll need to contact WooThemes helpdesk for support on the theme. Right?
For time being, I’ll try another theme and see what happens. Not sure if I’ll check this today though.
Thanks,
I don’t think storefront affects layered nav.. have you made any customisations at all?
I have all the customisations saved under the customisation plugin. and they for changing footer credits, removing sticky checkout, changing checkout button text, changing add to cart button text, and removing category count.
However, actually.. I just noticed that if I use AND query type for the widget, it hides the empty attributes. If I use OR query type, it shows empty ones.
Is this the default action?
Yes, I believe so. “OR” allows you to expand your search. “AND” narrows it down.
The reason I selected OR type was to allow customer to select multiple attributes per filter.
This was to let customer to select and display multiple screen size or storage size to their need.
Is it possible to do that using OR type query?
by the way, I really appreciate your assistance. Thanks,
In both cases, empty attributes don’t show up for me: https://cld.wthms.co/WFWk/2DGEutqQ
So it must be my customisation or plugin issue?
I’ll start with plugins..
I’ll deactivate plugins to see if anything helps.But I wonder why it happens only when I select OR query type.
Thanks,
I tried deactivating many plugins (and at the end all but WooCommerce) and nothing helped.
I tried switching theme to StoreFront and it still only takes AND type query to hide empty.
What would be next step to check what’s blocking OR type query to hide empty attributes?
Thanks,
Try going to WC > System Status > Tools > Recount terms
Is this 2.6 or 2.5.5?
WC version is 2.6
Clicked on Recount terms and the result is same.
Not sure if this matters, but I noticed php & mysql version is lower than required.
I updated php version to 5.6 now and requested hosting to update mysql version.
updating php version did not fix this issue though.
for customization, if this helps pinpoint –
I have below functions added to functions.php for some customization (in theme-customisation-master plugin
/* custom footer */ add_action( 'init', 'custom_remove_footer_credit', 10 ); function custom_remove_footer_credit () { remove_action( 'storefront_footer', 'storefront_credit', 20 ); add_action( 'storefront_footer', 'custom_storefront_credit', 20 ); add_action( 'storefront_footer', 'custom_footer_accepted_payments', 20 ); add_action( 'storefront_footer', 'custom_footer_securedby_seals', 20 ); } function custom_storefront_credit() { ?> <div class="site-info" style="float:left"> Price and availability are subject to change without notice. <br>© <?php echo '2015 - ' . date( 'Y' ) . ' | ' . '<a href="https://ngpstoreusa.com">NGPStoreUSA.com</a>' . ' | All Rights Reserved'; ?> </div><!-- .site-info --> <?php } function custom_footer_accepted_payments() { ?> <div class="site-info" style="float:right"> <div style="font-family: arial;font-weight:bold;font-size:13px;color:#FFFFFF;">Accepted Payments </a></div> <img style="float: left; margin-right: 5px;" src="/wp-content/uploads/2016/03/paypal_edit_65.png" alt="PayPal"/> <img style="float: left; margin-right: 5px;" src="/wp-content/uploads/2016/05/amazon-payments-logo.jpg" alt="Amazon Payments"/> </div> <?php } function custom_footer_securedby_seals() { ?> <div class="site-info" style="float:right"> <div style="font-family: arial;font-weight:bold;font-size:13px;color:#FFFFFF;margin-right:20px;">Secured By</a></div> <a href="https://www.positivessl.com" style="font-family: arial; font-size: 10px; color: #212121; text-decoration: none;"><img src="https://www.positivessl.com/images-new/PositiveSSL_tl_trans.png" alt="SSL Certificate" title="SSL Certificate" border="0" width="65" /></a> </div> <?php } /* remove sticky checkout */ add_action( 'wp_enqueue_scripts', 'jk_remove_sticky_checkout', 99 ); function jk_remove_sticky_checkout() { wp_dequeue_script( 'storefront-sticky-payment' ); } /* change checkout button text to Secure Checkout */ function woocommerce_button_proceed_to_checkout() { $checkout_url = WC()->cart->get_checkout_url(); ?> <a href="<?php echo $checkout_url; ?>" class="checkout-button button alt wc-forward"><?php _e( 'Secure Checkout', 'woocommerce' ); ?></a> <?php } add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); /* change cart button text to Buy Now */ function woo_custom_cart_button_text() { return __( 'Buy Now', 'woocommerce' ); } /* Remover Category Count */ add_filter( 'woocommerce_subcategory_count_html', 'woo_remove_category_products_count' ); function woo_remove_category_products_count() { return; }
in style.css I have these –
#post-6763 .entry-title { text-align: center; font-family: ‘Lucida Console’, Monaco, monospace; font-weight: Bold; } .page-template-template-homepage-php .hentry.page .o-homepage-content:after { content: ""; } .woocommerce-ordering { z-index: 1 !important; } body.single-product .ppt, body.single-product .pp_description { display: none !important; }
Thanks,
There was a 2.6.1 update too if you want to try it. There were some tweaks to counts.
I’ve been busy with other things..
For now I’ve set all to AND query type to provide easier view to our customers.I’ll close this thread for now, since I won’t be able to work on this particular issue for next few weeks due to other projects that need more focus.
When I free up and need some advise regarding this again, I’ll start new thread.
Thanks for the assistance!
Hoil
I seem to have the same problem. It works fine for AND query type, but if I change it to OR query type I also get the empty attributes. I tried disabling all plugins, but the problem persists. I did notice that I’m on MySQL version 5.5.31. Could this be the cause or is there anything else I can try?
You can see it here.
- The topic ‘Layered Nav widget hide empty atributes’ is closed to new replies.