- This topic has 3 replies, 2 voices, and was last updated 3 years ago by
David.
-
AuthorPosts
-
March 17, 2023 at 7:56 pm #2571763
Ron
I want to significantly rework the cart and checkout pages using CSS. Initially, I was just going to add the CSS to the theme style.css file, but it would appear I will have to use a lot of !important declarations to do that.
It appears that GP has a woocommerce.css file that is overriding the standard woocommerce css. is there any harm in making the changes that I want in the GP file located here?
wp-content/plugins/gp-premium/woocommerce/functions/css/woocommerce.cssIf this is not recommended, what is the best way to make CSS changes that don’t require me to overuse the !important declaration?
March 18, 2023 at 5:13 am #2572023David
StaffCustomer SupportHi there,
don’t edit any theme or plugin files, when an update happens those changes will get overwritten by the update.
Add your CSS to a child theme instead.
The issue with Woo, is the plugin has some very specific selectors.
In GP we tried to keep our selectors to the minimum specificity we could.But its not impossible to make your own CSS more specific through additional classes.
Worst case, its absolutely fine to use!importantits what its there for. Its only an issue if theme or plugin developers ( or WordPress core …. and they have ) use it as it makes it hard for the kind of customizations you need.If theres an example style thats causing you a headache let me know, happy to take a look.
March 18, 2023 at 9:24 am #2572371Ron
Yes. In the middle of the night, I realized just how terrible an idea that was.
I am by far no programmer, so it does get frustrating to read that you should always avoid using the !important statement by putting the CSS code in the right location and using more specific selectors. And then after spending time to try and just do that to be told, well, in this case, you just have to use !important.
Not blaming you or anyone specific. Just expressing my frustration with the inconsistencies.
March 18, 2023 at 10:33 am #2572442David
StaffCustomer SupportYeah, there are a lot of mixed opinions on this, and if its possible to find a way without using
!importantthen thats great. It may make a difference to future developers who may work on the site.But consider it like this – you add
!importantbecause you want to make sure your styles are used. And theres no problem in that.If theres any specific CSS needs let us know 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.