• Resolved antflora

    (@antflora)


    Hello,

    I am trying to exclude a script from being optimized, however, it is not being excluded.
    I have added the following to the exclude field in the settings:
    wp-content/plugins/product-delivery-date-for-woocommerce-lite/js/

    The script is used to select a delivery date, with x number of prep hours. The delivery date is not being calculated correctly, however, after manually deleted autoptimize cache the delivery dates are calculated correctly.

    Can you assist with this?

    Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    sure, can you share your site’s URL + the JS error you get on the browser console when Autoptimize JS optimization is on?

    Thread Starter antflora

    (@antflora)

    I am not getting a specific error, the dates are not calculated correctly.
    The next available delivery date should be today + 48 hours. So for example if its Monday the next available delivery date should be Wednesday.
    However, this 48 hour period is not being calculated correctly. For example on Tuesday it will display next available delivery date as Wednesday instead of Thrusday. Once I delete autoptimize cache manually it will correctly display the next available date as Thursday.
    Here is the a link where the delivery date could be found:
    https://florasent.com/flowers/meadow-fresh/

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, had a look at the HTML source and the product-delivery-date-for-woocommerce-lite JS files are there so the exclusion as such works, but as they are not minified AO minifies them. You can stop that by unticking the “also minify excluded CSS/ JS files” option, at which point you should see product-delivery-date-for-woocommerce-lite/js/ in the HTML source again. Can you do so to test if this fixes things?

    Thread Starter antflora

    (@antflora)

    Will untick and report back, need to wait for 24 hours to see if it updates correctly.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    if 24 hours then the issue is likely with a nonce being cached by page caching having expired antflora, see e.g. https://docs.wp-rocket.me/article/975-nonces-and-cache-lifespan for info on that subject.

    Thread Starter antflora

    (@antflora)

    sorry for the late reply. I should clarify, the reason I said 24 hours is because the script updates the next available delivery date based on today’s date. I need to wait until its the next day to make see if the available delivery date is calculated correctly.

    • This reply was modified 4 years, 1 month ago by antflora.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, so with “minify excluded CSS/ JS” off, does the problem still occur?

    Thread Starter antflora

    (@antflora)

    Yes, the problem still occurs. I have to manually delete the cache in order for the correct delivery date to be calculated.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    This _really_ does smell like a page caching issue to me antflora (the fact that is disappears when clearing AO’s cache makes sense, as when cleared AO tries to tell page caching plugins to clear as well). What do you use for page caching?

    Thread Starter antflora

    (@antflora)

    I am using Cache Enabler by KeyCDN

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    what is the cache expiry set to?

    Thread Starter antflora

    (@antflora)

    It was not set to expire. I have disabled that plugin to see if that is causing an issue. What would you recommend to set the expiry at?

    Thread Starter antflora

    (@antflora)

    Also, since I am running woocommerce. Is there anything else I should be excluding from Autoptimize to make sure there are no issues?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    re. cache enabler expiry; I would set it to 8h (that _should_ fix any potential issues with nonces)

    re. woocommerce; the safe thing is to disable “also optimize cart/ checkout”

    Thread Starter antflora

    (@antflora)

    You’re correct, it was the page cache. I have excluded the product pages from being cached in Cache Enabler and the issue is resolved.

    Thanks for your help!

    • This reply was modified 4 years, 1 month ago by antflora.
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Exclude JS script not working’ is closed to new replies.