Develop WC

The official WooCommerce development blog

A new product gallery coming to 2.7. Maybe. — August 18, 2016

A new product gallery coming to 2.7. Maybe.

The product image galleries in WooCommerce basically haven’t changed since version 1. The layout is fine, but the lightbox functionality is looking more than a little tired.

Most importantly the experience on smaller handheld devices is terrible. We’d like to replace the lightbox functionality entirely with a carousel/zoom combination which will provide a lightweight, intuitive experience for both desktop and handheld devices.


Just so we’re on the same page as to exactly how terrible our current implementation is for small screens check this out;

That’s right, the image that appears in the lightbox is actually smaller than the image displayed in the page itself.

Of course we could just disable the lightbox for small screens, but without a carousel it wouldn’t be possible to see the additional images at a size any larger than the small thumbnails. We need another solution.

How do we propose to address this?

I think we can agree that the lightbox is pointless on small screens. What works very nicely is a carousel with touch support to easily swipe between images. Something like this:


I don’t expect many WooCommerce users to be opposed to this change. What I’d really like you to consider is how our galleries behave on desktop.


We’ve agreed that a carousel is better for mobile. I happen to like the carousel for navigating the gallery on desktop as well. We’re already loading the script for mobile so it makes sense to use it on desktop too.

The question then becomes; How do we provide the ability to see the image in greater detail? There are a couple of potential answers to that question each with it’s own pros/cons.


The pros of using a lightbox are that it is familiar. It’s what we have currently.

But that’s about it.

The cons are several

  • Lightbox scripts are fairly hefty and include a lot of functionality that we don’t really need
  • Generally require additional assets (css) on top of the js
  • Given we’ve agreed that a carousel is the way to go for gallery navigation, it’s somewhat counter intuitive to have that method of navigation in addition to lightbox gallery navigation


Zooming in on the main product image as you hover over it is an alternative option. Here’s how that would look;


The pros

  • It provides a very intuitive overall experience. You click the thumbnail you want to look at then simply hover over the main image for more detail.
  • It’s lightweight. Including CSS, PrettyPhoto (our current lightbox script) weighs in at 30kb. The zoom script is 6kb. That’s an 80% decrease!
  • It’s consistent – the desktop / mobile experience mirror one another.

The cons

  • This solution is dependent on the theme to display the product image at a reasonable size. If the image is tiny, zooming might feel a little awkward.
  • It’s different. Not sure this is necessarily a con but it’s a very important to consider for store owners. Changes like this do have the potential for disruption.


I really wouldn’t want to do this, but it is of course an option to have zooming and a lightbox.

Over to you

What do you think? We’re very keen to hear feedback on this idea, in particular on the desktop behaviour.

If you’d like to actually test this functionality please check out the add-product-galleries branch on github. It goes without saying that you should only do this in a development environment.

Please vote in the poll!

A note to theme authors

This change involves template changes to templates/single-product/product-image.php and templates/single-product/product-thumbnails.php as well as the addition of two new scripts and a little css. If you dequeue WooCommerce styles in your theme and roll your own, you’d need to add some css to support the new gallery.


WooCommerce 2.6.4 Fix/Security Release Notes — July 26, 2016

WooCommerce 2.6.4 Fix/Security Release Notes

The WooCommerce 2.6.4 fix/security release is now available. You can download it on or as an automatic update in your administration panel.

~20 commits made it into this release fixing several minor issues. The main changes are as follows.

  • The REST API image upload feature has been locked down to only allow images, vs all supported WordPress MIME types.

  • There was an issue in COD where shipping method titles were missing.
  • WC_ROUNDING_PRECISION constant was removed but put back for plugin compatibility reasons.

The full changelog for 2.6.4 is below.

* Fix - Security - Only allow image MIME type upload via REST APIs.
* Fix - Shipping method title display in COD settings.
* Fix - Order date input in Edge browser.
* Fix - Ensure value is not null in variations to support empty show_option_none setting.
* Fix - get_the_title does not need escape in grouped template file.
* Fix - Ensure WC_ROUNDING_PRECISION is defined and use it as a low precision boundary in wc_get_rounding_precision().
* Fix - Response body should be a string in webhook class.
* Fix - Use h2 instead of h3 headings in profile screen.
* Dev - API - Allow Allow meta_key/value filters for products.
* Dev - CLI - Explode tags and category IDs to allow multiple comma separated values.
* Dev - add $order arg to woocommerce_admin_order_item_class and woocommerce_admin_html_order_item_class filters..

If you spot any further issues, please report them to us in detail on GitHub so the development team can review – comments on this post are closed.

WooCommerce 2.6.3 Fix/Security Release Notes — July 19, 2016

WooCommerce 2.6.3 Fix/Security Release Notes

The WooCommerce 2.6.3 fix/security release is now available. You can download it on or as an automatic update in your administration panel.

~104 commits made it into this release fixing several minor issues and a potential security issue. The main fixes/updates are as follows.

  • Securify reported an issue with the way captions were shown within PrettyPhoto. Due to double-escaping, captions could be treated as HTML allowing for XSS attacks. However, this would require the admin to upload a malicious image to exploit. The affected template files were patched and the version numbers bumped.

  • There was an issue with layered nav counts when used in conjunction with search.
  • We added transient based caching to the comment count functions to improve page loading speed in admin.

The full changelog for 2.6.3 is below.

* Fix - Security - Escape captions in product-thumbnail and product-image templates (template versions have been bumped).
* Fix - Fixed how we calculate shipping tax rates when using more than one tax class.
* Fix - When duplicating product variations, set title, name, and guid.
* Fix - Normalized 'read more' buttons.
* Fix - Add to cart notices for grouped products.
* Fix - Do not sanitize passwords in the settings API.
* Fix - Handle shipping zone location range conversion during update (dashes to ...).
* Fix - Always remove commas while processing flat rate costs.
* Fix - Ensures account page layout is only applied to desktop-sized displays.
* Fix - When getting layered nav counts, take search parameters into consideration.
* Fix - Free shipping show/hide javascript.
* Fix - Strip hash characters when exporting reports.
* Fix - Use permission id to revoke access to downloads to prevent removing wrong rows.
* Fix - When duplicating product variations, set title, name, and guid.
* Fix - Set more appropriate default rounding precision based on currency decimal places.
* Fix - Fix message styles for empty carts.
* Fix - Fixed the load of the WC_Email_Customer_On_Hold_Order class.
* Fix - Don't perform cart update on search submit.
* Dev - API - Added support for WP REST API with custom URL prefixes.
* Dev - API - Delete variations when deleting a variable product.
* Dev - API - Fixed how we check for product types.
* Dev - Added woocommerce_cart_id filter.
* Dev - Add shortcode name param to shortcode_atts function calls.
* Dev - Post custom data when fetching a variation via ajax.
* Dev - Include child prices in grouped_price_html filter.
* Dev - Allow filtering of variation stock quantity.
* Dev - Added $_product argument to 'woocommerce_restock_refunded_item' hook.
* Dev - Added a filter hook for the wc_ajax endpoint url.
* Tweak - Include account page link in new customer account emails.
* Tweak - Updated all URLs from to
* Tweak - Cache the result of WC_Comments::wp_count_comments() in a transient (improves performance).

If you spot any further issues, please report them to us in detail on GitHub so the development team can review – comments on this post are closed.

WooCommerce 2.6.2 Fix Release Notes — June 30, 2016

WooCommerce 2.6.2 Fix Release Notes

The WooCommerce 2.6.2 fix release is now available. You can download it on or as an automatic update in your administration panel.

~140 commits made it into this release fixing several minor issues and making some smaller tweaks. The main fixes/updates are as follows.

  • We’ve made the password reset process redirect to the form and set a cookie containing the reset token and username to prevent password tokens being leaked via the page’s referer headers.
  • Some users didn’t like the change showing ‘in stock’ when not managing stock levels. Due to this we’ve made it so ‘in stock’ in hidden when not managing stock levels, but ‘out of stock’ is shown when that status is explicitly set.
  • We’ve improved the coupon logic so that product coupons not valid for the current cart are not applied, rather than just having no discount value.
  • We’ve made some tweaks the descriptions on the zones screen, and made it so zones can match postcodes without having a country assigned to them. Also, if no locations are set on a zone, it will now be listed as being for ‘everywhere’.
  • To allow my account page tabs to be disabled without code, you can now set the endpoint value to a blank string.

The full changelog for 2.6.2 is below.

* Fix - Set max index length on woocommerce_payment_tokenmeta table for utf8mb4 support.
* Fix - is_available check for legacy shipping methods.
* Fix - wc_add_to_cart_message() when non-array is passed.
* Fix - Maximum coupon check should allow the 'maximum' value.
* Fix - Product coupon logic to avoid applying non-applicable coupons.
* Fix - Potential notices when leaving out 'default' field for shipping instances.
* Fix - wp_cache_flush after term meta migration/update.
* Fix - wc_add_to_cart_message() when non-array is passed.
* Fix - woocommerce_redirect_single_search_result type check was incorrect.
* Fix - Javascript show/hide of option in free shipping method.
* Fix - Convert ellipsis to three periods when saving postcodes.
* Fix - Prevent get_terms returning duplicates.
* Fix - Removed non-existent country (Netherlands Antilles) from
* Fix - Grouped product range display when child is free.
* Fix - Remove discount when checking free shipping min amount.
* Fix - Prevent blocking the same element multiple times on cart page.
* Fix - Don't sync ratings right after a new comment to prevent rating sync whilst rating meta does not exist yet.
* Fix - Fix product RSS feeds when using shop base.
* Fix - woocommerce_local_pickup_methods comparison by stripping instance IDs before the check.
* Fix - During password resets, use cookie to store reset key and user login to avoid them being exposed in the URL/referer headers.
* Dev - API - Fixed variable product stock at product level.
* Dev - CLI - Introduces woocommerce_cli_get_product_variable_types filter.
* Dev - Allow notices to be grouped on checkout after certain events.
* Tweak - Made customer pay link display if order needs_payment() rather than checking pending status.
* Tweak - Zones - Wording clarifications.
* Tweak - Zones - Match zones with postcodes but no country.
* Tweak - Zones - Match zones with no regions as 'everywhere'.
* Tweak - Added view_admin_dashboard cap for disabling the admin access restriction in custom roles.
* Tweak - Revised stock display based on feedback to hide 'in stock' message if stock management is off and only show available on backorder if notifying customer.
* Tweak - Allow external product SKUs.
* Tweak - PT (Portugal) and JP (Japan) postcode formats.
* Tweak - Sort products from the [product_category] shortcode by menu order.
* Tweak - Improve wc_orders_count() performance by running a query to count only posts of the given status.
* Tweak - To allow my account page tabs to be disabled without code, you can now set the endpoint value to a blank string.

If you spot any further issues, please report them to us in detail on Github so the development team can review – comments on this post are closed.

WooCommerce Connect moves into Alpha 2 — June 27, 2016

WooCommerce Connect moves into Alpha 2

For the last couple months, since the first Alpha release, we’ve been diligently working on WooCommerce Connect.

We’re excited to announce that we have more features you can exercise in the latest Alpha release. WooCommerce Connect now supports:

    • Real-time rate requests for Canada Post as well as USPS
    • Merchant defined custom packaging as well as Flat Rate USPS packaging
    • A “Self-Help” style debug dashboard to help you see how all the WooCommerce Connect services you are using are doing at a glance

ICYMI – Connect is a new architecture for integrating services with WooCommerce. We’re taking advantage of a SaaS-style Automattic-hosted server to do the heavy lifting and have created a new Calypso-style interface. More on the project here.

Maybe you tried the first Alpha, or maybe you were waiting to see what came next – either way we’d like to welcome you to testing this latest iteration.

Join us in building the future of WooCommerce

Release Highlights

This second Alpha release of WooCommerce Connect works with recently released WooCommerce 2.6 and with Jetpack to bring hassle free USPS and Canada Post rates to WooCommerce Shipping Zones.

Since this is an alpha version, there’s a lot we plan to add, change and enhance. Please take care – this early pre-release code should not be used on production sites.

At this time, WooCommerce Connect is delivered as a feature plugin, and the grand plan is to roll out Connect into a future WooCommerce core release.

For developers, this is an great opportunity to:

      • see the future of WooCommerce development
      • see examples of incorporating React into WooCommerce administration
      • see how we’re using JSON schemas provided by the WooCommerce Connect servers to drive the layout and composition of the forms for shipping services – making adding features much less likely to require plugin updates
      • see examples of how to extend the WP REST API and Shipping Zones in WooCommerce 2.6

Alpha 2 Testing

Alpha 2 is out today. Subsequent alphas will be released if needed and we’ll post on this blog if this happens.

If all goes to plan, Beta will begin during Summer of 2016.

If you’d like to help test, sign-up to be a tester – we’d love to hear from you!


Get every new post delivered to your Inbox.

Join 7,851 other followers