Site logo

[Resolved] Directly Editing The GP woocommerce.css File

Home Forums Support [Resolved] Directly Editing The GP woocommerce.css File

Home Forums Support Directly Editing The GP woocommerce.css File

  • This topic has 3 replies, 2 voices, and was last updated 3 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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.css

    If this is not recommended, what is the best way to make CSS changes that don’t require me to overuse the !important declaration?

    #2572023
    David
    Staff
    Customer Support

    Hi 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 !important its 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.

    #2572371
    Ron

    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.

    #2572442
    David
    Staff
    Customer Support

    Yeah, there are a lot of mixed opinions on this, and if its possible to find a way without using !important then thats great. It may make a difference to future developers who may work on the site.

    But consider it like this – you add !important because you want to make sure your styles are used. And theres no problem in that.

    If theres any specific CSS needs let us know 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.