Exciting news! We're joining GoDaddy ➡️
WooCommerce reviews + tutorials
2/10/2012 Update – The good people of WooCommerce have fixed this issue as of the 1.4.2 release, so the modification described in this article is no longer needed. I have left the rest of the article untouched for historical curiosity.

As I described in my most recent news posting, WooCommerce 1.4 while a great update to the excellent E-Commerce offering from WooCommerce, did include at least one very minor bug. This issue would apply only to those who serve their administration over SSL, which is most likely just me, and by now you can probably guess is the age-old mixed content issue.

I first realized something was amiss when soon after updating my production server to the latest and greatest I saw the tell-tale crossed-out https and lock in Chrome on the SSL-protected checkout page of foxrunsoftware.net. Firefox users will be familiar with this as the subtly disappearing SSL color bar, and IE users know it as in-your-face Security Information/Warning popups, and Information Bar messages. With a heavy heart I navigated to the checkout page from Firefox to investigate the issue, but was surprised to see the problem didn’t exist in Firefox.

Cache-only Business

I swear I’ve nearly spent more hours chasing phantom bugs related to browsers caching unexpectedly than I have getting things to work in IE. Nearly. After a bit of searching it turned up that Chrome has a habit of caching that SSL mixed-content warning for some reason and displaying it on perfectly un-mixed SSL pages elsewhere on a domain. After that it was only a few moments to find the culprit in the wordpress administration, an external CSS file always requested over http:

http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css?ver=3.3.1

And a few moments more to code the fix:

if ( force_ssl_admin() || is_ssl() ) {
  add_action('woocommerce_admin_css', 'foxrunsoftware_woocom_admin_ssl');
}

function foxrunsoftware_woocom_admin_ssl() {

  wp_dequeue_style( 'jquery-ui-style' );
  wp_deregister_style( 'jquery-ui-style' );

  wp_enqueue_style( 'jquery-ui-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
}

Or packaged up into a mini plugin, if you prefer: foxrunsoftware-woocom-admin-ssl.zip

Published by Justin Stern

Justin is one of our co-founders, and is our resident overengineer. He likes to write developer tutorials and make black magic happen in our plugins. He thinks that writing code is a lot easier than writing words.