• Resolved kojaa

    (@kojaa)


    Hello, so for the past few days i had to make few css changes on the website, so i uploaded new css file to the website, however when i flush the cache the old cache is being loaded until i delete browser cache by my own. This is okay for me as a developer but there is users that don’t do this and they think the website is broken. Can anyone help me on this one?

    Edit: yes, i have tried every single flush method that w3tc offers.

    • This topic was modified 6 years, 11 months ago by kojaa.
    • This topic was modified 6 years, 11 months ago by kojaa.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Can you please share your settings in Performance>Browser Cache, JS&CSS sub-box.

    Thread Starter kojaa

    (@kojaa)

    Hello,
    Here: screenshot1
    screenshot2

    I just saw that expire time is set to 1 year, so im guessing this is the problem?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Try enabling Set cache control header cache with validation (“public, must-revalidate, proxy-revalidate”).
    In this case, only Hard reload will be sufficient.

    Thread Starter kojaa

    (@kojaa)

    Hello,
    That did not help, my new css is still not loading.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Have you tried visiting the page from the incognito window? Also is minify enabled? If so try to disable minify and delete the cache folder in your wp-content folder.

    Thread Starter kojaa

    (@kojaa)

    Hello,
    That did not help as well, incognito works of course because there is no cache, but visitors that already have accessed website still see the old version, i’m sorry but i will have to switch plugin, thanks for your time Mare 🙂

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Does this happen on all browsers?

    Thread Starter kojaa

    (@kojaa)

    Hello,
    It was happening in all browsers, the ones i tested were Mozilla, Chrome, Edge.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    The users are getting a cached version of the existing CSS. When you updated your CSS its name remained the same. All CSS files have a query string at the end that basically represents the version of the WP i.e. /style.css?ver=5.2.2". SO when the browser tries to fetch that file, and it’s always the same file, it says, no, Already have this one. What you need to do is generate a random query string at the end of that updated CSS file so the browser on the user end can see it as a new file and present it to the user.
    You can check here for more details on how to achieve this.

    Thread Starter kojaa

    (@kojaa)

    Hello,
    Sorry for the late response, but that actually did solve my problem, not the tutorial itself but it gave me an idea that woocommerce is storing their css based on version so i had to change it manually basically.

    This is what i did for my specific problem:
    (Using storefront child theme)

    I was digging through code and i found that they are versioning their css here class-storefront.php
    The exact script that they are using is:
    wp_enqueue_style( ‘storefront-style’, get_template_directory_uri() . ‘/style.css’, ”, $storefront_version );

    – So what i did is basically i replaced
    $storefront_version with ‘0.0.1’ as this is my css version. Which resulted in this wp_enqueue_style( ‘storefront-style’, get_template_directory_uri() . ‘/style.css’, ”, ‘0.0.1’ );

    Now please keep in mind that this is not the greatest solution and this will be overriden in every woocommerce update. But this does fix my issue.

    Thanks for your time Mare, have a great day 🙂

    • This reply was modified 6 years, 11 months ago by kojaa.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,

    You are welcome Koja. Thank you for sharing the solution.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘old css cache staying after flushed’ is closed to new replies.