Conversation
supportHello there, I have a strange issue with Yith WooCommerce Compare v 3.2.0 (same with 3.3.0). The CSS file compare.css is not loading when I change the site language. Works in French (default) but not in other languages (WPML). I have deactivated css minifying/js minifying (WP Rocket). Still the issue. I try that snippet to force CSS compare.css to load and that works again : add_action( ‘wp_enqueue_scripts’, function() { wp_enqueue_style( ‘yith-woocompare-force’, YITH_WOOCOMPARE_ASSETS_URL . ‘/css/compare.css’, array(), YITH_WOOCOMPARE_VERSION ); }); But this not a good solution… Did somenone met that issue ? Any idea ? Thanks for your help.
Hello there, thanks for contacting us! This is the first time we have had this report. I recommend running the following tests to see if the problem disappears at some point: Update the plugin, WC, and WP to the latest version. Switch to a default WP theme like 2025. Leave only WC and our plugin active, and activate your plugins in batches until you find the one that conflicts. Could you check it, please? Best regards.
Hello Juan, I guess i have found something. For example, with german language. The compare.css file is identified here in page source code : <link rel='stylesheet' id='yith_woocompare_page-css' href='https://preprod.xxx.com/de/wp-content/plugins/yith-woocommerce-compare/assets/css/compare.css?ver=3.4.0' type='text/css' media='all' /> —-> 404 As you can see, there is a /de/ in url. In class-yith-woocompare-frontend.php, the stylesheet_url() method uses : $asset_url = home_url( $asset_path ); which return URL of home page with active language. If I use : $asset_url = site_url( $asset_path ); compare.css is loading fine (no language in url –> no 404) Hope it could help. Let me know. Thanks
Hello there, Please replace this line: $asset_url = home_url( $asset_path ); with this new one: $asset_url = apply_filters( 'yith_woocompare_asset_url', home_url( $asset_path ), $asset_path ); then, add the following code in the functions.php file of your active theme: if ( ! function_exists( 'yith_woocompare_asset_url_custom' ) ) { function yith_woocompare_asset_url_custom( $url, $asset_path ) { return site_url( $asset_path ); } add_filter( 'yith_woocompare_asset_url', 'yith_woocompare_asset_url_custom', 99, 2 ); } If it works correctly for you, we will add it to the next version of the plugin. Could you check it, please? Best regards.
Hello Juan Works for us. Thanks. Best regards
Hello there, Could you confirm me correction has been included into the 3.7.0 version of module so I could remove snippet inside functions.php ? Best regards
Hello there, thanks for contacting us! This is the first time we have had this report. I recommend running the following tests to see if the problem disappears at some point: Update the plugin, WC, and WP to the latest version. Switch to a default WP theme like 2025. Leave only WC and our plugin active, and activate your plugins in batches until you find the one that conflicts. Could you check it, please? Best regards.
Hello Juan, I guess i have found something. For example, with german language. The compare.css file is identified here in page source code : <link rel='stylesheet' id='yith_woocompare_page-css' href='https://preprod.xxx.com/de/wp-content/plugins/yith-woocommerce-compare/assets/css/compare.css?ver=3.4.0' type='text/css' media='all' /> —-> 404 As you can see, there is a /de/ in url. In class-yith-woocompare-frontend.php, the stylesheet_url() method uses : $asset_url = home_url( $asset_path ); which return URL of home page with active language. If I use : $asset_url = site_url( $asset_path ); compare.css is loading fine (no language in url –> no 404) Hope it could help. Let me know. Thanks
Hello there, Please replace this line: $asset_url = home_url( $asset_path ); with this new one: $asset_url = apply_filters( 'yith_woocompare_asset_url', home_url( $asset_path ), $asset_path ); then, add the following code in the functions.php file of your active theme: if ( ! function_exists( 'yith_woocompare_asset_url_custom' ) ) { function yith_woocompare_asset_url_custom( $url, $asset_path ) { return site_url( $asset_path ); } add_filter( 'yith_woocompare_asset_url', 'yith_woocompare_asset_url_custom', 99, 2 ); } If it works correctly for you, we will add it to the next version of the plugin. Could you check it, please? Best regards.
Hello Juan Works for us. Thanks. Best regards
Hello there, Could you confirm me correction has been included into the 3.7.0 version of module so I could remove snippet inside functions.php ? Best regards