Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Uplift › Woocommerce css not loading on HTTPS
New Landing › How can we help? › Themeforest Theme Support › Uplift › Woocommerce css not loading on HTTPS
Tagged: checkout, features, Https, optimization, performance, secure, Security, SSL, woocommerce
- This topic has 6 replies, 5 voices, and was last updated 8 years by Swift Ideas – Ed.
-
Posted in: Uplift
-
July 19, 2016 at 11:05 am #282259
Hi Team,
We’re having issues with styles and ajax not loading on certain pages when they are forced to HTTPS. Our site is forced to HTTPS. We’ve had to implement this temporary code. Any idea how to do a permanent fix?
Cheers
A
/* TEMP – Fix lost Wooocommmerce Styles (stars etc)
================================================== */function wdm_add_woocommerce_styles(){
return array(
‘woocommerce-layout’ => array(
‘src’ => str_replace( array( ‘http:’, ‘https:’ ), ”, WC()->plugin_url() ) . ‘/assets/css/woocommerce-layout.css’,
‘deps’ => ”,
‘version’ => WC_VERSION,
‘media’ => ‘all’
),
‘woocommerce-smallscreen’ => array(
‘src’ => str_replace( array( ‘http:’, ‘https:’ ), ”, WC()->plugin_url() ) . ‘/assets/css/woocommerce-smallscreen.css’,
‘deps’ => ‘woocommerce-layout’,
‘version’ => WC_VERSION,
‘media’ => ‘only screen and (max-width: ‘ . apply_filters( ‘woocommerce_style_smallscreen_breakpoint’, $breakpoint = ‘768px’ ) . ‘)’
),
‘woocommerce-general’ => array(
‘src’ => str_replace( array( ‘http:’, ‘https:’ ), ”, WC()->plugin_url() ) . ‘/assets/css/woocommerce.css’,
‘deps’ => ”,
‘version’ => WC_VERSION,
‘media’ => ‘all’
),
);
}
add_filter( ‘woocommerce_enqueue_styles’, ‘wdm_add_woocommerce_styles’,15);July 19, 2016 at 2:12 pm #282366Hi,
Please install this plugin https://wordpress.org/support/plugin/wordpress-https. It will help you.
Thanks
MohammadJuly 19, 2016 at 5:39 pm #282407We already have that installed : )
It seems that SF is removing woocommerce scripts if it doesn’t find woocommerce css classes on the page.
Dev feedback
After analysis, we found that the WooCommerce’s JS( like woocommerce.min.js , add-to-cart.min.js, etc ) are not loading on site pages. The code of dequeuing this scripts in theme (themes/uplift/swift-framework/core/sf-woocommerce.php From function sf_remove_woo_scripts Line – 44) . Here it checks if the body on the page contains CSS class woocommerce and depending on this condition it dequeues the script on unnecessary pages.
Cheers,
A
July 20, 2016 at 8:08 am #282518Will forward this to the developer
– Kyle
July 20, 2016 at 11:18 am #282589Hi @HB
That is true – if you don’t want that functionality, you can disable it in Theme Options > General > Performance > Swift Smart Script => Off.
– Ed
July 27, 2016 at 7:58 am #284133Hi Swift Team,
Question 1: Would you all be willing to explain a little more of what this means?
Question 2: Are you saying that if we use WooCommerce and “Force HTTPS on checkout” (or the My-Account Page, etc.) that we need to turn of the Swift Smart Script?
Question 3: Is there a way where you guys could update it so that it could work with HTTPS or is that too hard?
We would love to use the Smart Script but we definitely need HTTPS for checkout/credit card payments, etc.
Thanks guys!
July 28, 2016 at 11:45 am #284560Hi @calebweeks
The SmartScript functionality should only remove scripts from pages where they aren’t needed. Such as the “add to cart variations script”, from the cart/checkout pages (where they aren’t used).
If you are having issues / your dev is saying that is the issue, then please try disabling that option and seeing if it resolves it. We can then look to adjust from there if it’s something we need to change our end.
Hope that explains it.
– Ed
-
Posted in: Uplift
You must be logged in and have valid license to reply to this topic.