• Resolved imcobarn

    (@imcobarn)


    I’m using “define( ‘WP_PLUGIN_DIR'” and define( ‘WP_PLUGIN_URL’,” in wp-config
    Noticing that woocommerce font is not loading as it is still looking into “/plugins/” directory
    Also Woocommerce css has hard coded /plugins/ path in it.

    How to fix this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    This is not what we would expect to see with the release build from www.remarpro.com.

    Can you please elaborate on where you are seeing this path?

    Thread Starter imcobarn

    (@imcobarn)

    Hi,

    Looking in source code via browser developer tools.
    Console shows error “Failed to load resource: the server responded with a status of 404 (Not Found) – WooCommerce.woff:1 ”

    Then in “sources” tab looking at woocommerce.min.css shows this:
    “@charset “UTF-8″;@keyframes spin{100%{transform:rotate(360deg)}}@font-face{font-family:star;src:url(../../../../../../../plugins/woocommerce/assets/fonts/star.eot);”

    Just looked at the css file itself and it is not hard coded but it is like this:
    “@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format(“embedded-opentype”),url(../fonts/star.woff)”

    So src:url(../fonts looks in /plugins/fonts directory and ignores constants defined in wp-config I guess?

    In Firefox I get “downloadable font: download failed (font-family: “WooCommerce” style:normal weight:400 stretch:100 src index:1): status=2147746065 source: https://mywebsite.com/custom-content/plugins/woocommerce/assets/fonts/WooCommerce.woff”
    It is interesting as I also use “WP_CONTENT_URL” and “WP_CONTENT_DIR” constant set to “custom-content” so it recognizes that apparently but not plugins URL/DIR.

    Thanks.

    • This reply was modified 4 years, 5 months ago by imcobarn.

    Hi @imcobarn ,

    The CSS code can’t read the WordPress variables from the browser, so it does use relative paths to get to the locations it needs.

    Can you check your Network tab to make sure that fonts folder is loading, even if it’s coming into a different path?

    I also noticed you are setting both the _DIR and _URL constants for content and plugins. May I ask what those are set to? I wanted to double check, because of this:

    I also use “WP_CONTENT_URL” and “WP_CONTENT_DIR” constant set to “custom-content” so it recognizes that apparently but not plugins URL/DIR.

    I just wanted to confirm that WP_CONTENT_URL isn’t set to just custom-content as it should be set to the full URL of the content folder with no trailing slash.

    Based on what you’re describing, the constants should be something like this:

    
    define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/path/to/custom-content' );
    define( 'WP_CONTENT_URL', 'https://mywebsite.com/custom-content' );
    define( 'WP_PLUGIN_DIR', dirname(__FILE__) . 'path/to/your-plugins-folder' );
    define( 'WP_PLUGIN_URL', 'https://mywebsite.com/your-plugins-folder' );
    

    Are your constants set this way? If you wouldn’t mind sharing what those are set to, I can try reproducing this locally to track where the issue is occurring.

    I also noticed that there is a PLUGINDIR option to handle some compatibility issues. Do you have that constant set? If not, can you try setting it to see if it makes a difference? That’ll help see what’s happening, as well.

    Thanks!

    Thread Starter imcobarn

    (@imcobarn)

    @mikestraw yes that is exactly how they are set:

    define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/core-content' );
    define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/core-content/modules' );
    define( 'WP_CONTENT_URL', 'https://myshop.com/core-content' );
    define( 'WP_PLUGIN_URL',  'https://myshop.com/core-content/modules' );

    Thanks for looking into this.

    Hi @imcobarn ,

    Thanks for that! I was able to reproduce the issue on my own test site and have reported it to the developers here: https://github.com/woocommerce/woocommerce/issues/28097

    Since this is now being handled within that GitHub issue, I’m going to mark this thread as resolved. You can monitor the bug for the latest status.

    If there’s anything else you need help with, you can open a new thread.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Woocommerce css has hard coded /plugins/ path’ is closed to new replies.