Sometimes, something simple can cause big problems.
The Problem
WooCommerce recently made some significant changes to their plugin. These changes caused a custom page template for one of our clients to break. Product images that were once being populated, were no longer being loaded on the page. The link to the product was still being added to the page, but the image was not.
A little bit of digging revealed that the issue was due to changes made in WooCommerce version 2.6. One of the significant changes can be found in the file wc-term-functions.php:
* WC tables for storing term meta are @deprecated from WordPress 4.4 since 4.4 has its own table.
In order to access the URL for the image, we had been using the get_metadata() function; however, that function doesn’t work anymore due to the data being stored in a different table.
The Solution
The fix was actually pretty simple. Anywhere that the get_metadata() function was in use, we simply replaced it with the get_term_meta() function. This accessed the data from the WordPress table instead of trying to access it from the old WooCommerce table.
The WooCommerce Way
If you’re needing to make this change to your own templates, I would suggest using the get_woocommerce_term_meta() function as a way to bridge the gap between WooCommerce versions. This particular function will search the new WordPress table location first, and then will search the old WooCommerce table location if needed.