Check your HTML body
classes in a rendered page – you should find that Woocommerce inserts classes when you’re on a shop page, so you shouldn’t need any custom PHP, just some CSS:
eg, to style something with the class myfabdropdown
on all normal pages:
body .myfabdropdown { background-color: white; }
and then to style the same element just on Woocommerce pages:
body.woocommerce .myfabdropdown { background-color: yellow; }