I would like to find a way to change the CSS of a product depending on the category it is in.

For example:

Valentines (ID31) Mothers Day (ID32)

Some of the products may be in other categories also, If the product is in a standard category than the CSS should not change and remain in the standard format. The css should only change for the products assigned to the above categorie OR sub categorie.

1 Answer 1


The closest you will get in core Magento is to create a custom theme and apply it to a category. Ensure that Apply To Products is set to Yes and that it's child categories have Use Parent Category Settings set to Yes. When viewing the product directly from the category it should then have the theme.

  • This worked perfectly, thanks for your help Peter. Commented Feb 15, 2016 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.