Weird CSS targeting issue on woocommerce variants
-
Hi all,
Admittedly I’m not on my A game today, but I’ve been staring at this for an hour now and have only succeeded in getting more frustrated. I created a woocommerce store for a client. When a user is not logged in, they will not see certain things. I’ve accomplished this with a php/css hack in header.php
<?php if (!is_user_logged_in()): ?> <style> .whatever { display: none !important; } </style> <?php endif ?>
I’ve been instructed to hide all drop down menus on products if a user is not logged in – these are woocommerce variants. I am to leave the swatches variants though, so I can’t create a CSS declaration to hide all variants, I have to target them each individually.
So I have this:
label[for="pa_gauge"], select#pa_gauge, label[for="pa_length"], select#pa_length, label[for="pa_nostril"], select#pa_nostril, label[for="pa_style"], select#pa_style, label[for="pa_ball-size"], select#pa_ball-size, label[for="pa_diameter"], select#pa_diameter, label[for="pa_bead"], select#pa_bead, label[for="pa_other"], select#pa_other { display: none !important; visibility: hidden !important; }
That hides them in their product categories: http://bodygems.wpengine.com/product-category/industrial-barbells/
But not on the archive page that shows all products, or the featured products at the bottom of the homepage:
http://bodygems.wpengine.com/showcase/The only difference I can find CSS wise is the body class. But why should that matter if the same selectors apply on the label and select elements on all products across the board? I don’t see anything that could be overriding my styles on the
/showcase/
archive. I tried listing some with body classes also but it didn’t work.Example:
label[for="pa_gauge"], select#pa_gauge, body.archive label[for="pa_gauge"], body.archive select#pa_gauge
but that doesn’t work eitherAny help would be appreciated!
- The topic ‘Weird CSS targeting issue on woocommerce variants’ is closed to new replies.