Fixes the issue described in #21299 by sorting terms by parent ID.
Remove the extra get_term call because we already have a term object.
Since we support 4.7+, also removed function exists for wp_list_sort function.
Remove heavy queries from transient cleanup function
Removes unneccessary loops and heavy queries.
There is a parent update and cache clear which was added in #17141. This cleanup is handled in `update_attributes` so doing it again here should be unneccessary.
Finally, the layered nav cleanup here can be moved. #22029 notes that this was needed in case of a stock change affecting product visibility. If we move to the data store, we can avoid getting the product here which is slower.
wc_count_comments is completely unrelated to products. This can be moved to the transient cleanup tool, because code already exists to clear this cache when needed in WC_Comments.
This commit moves the code to delete wc_layered_nav_counts_* transients from WC_Product_Data_Store_CPT::update_attributes() to wc_delete_product_transients(). This way those transients will be deleted whenever a product is updated and not only when the product attributes are updated. This is needed to make sure that the "Filter Products by Attribute" displays the correct list of attributes when a product changes from out of stock to in stock or vice versa via the "Quick Edit" interface or the WC API.
in the template for the product image, wc_placeholder_img_src() returns the thumbnail size of the image.
In order to use 'woocommerce_single' as size, the function needs to be corrected, so the function use the size and not a calculated array of sizes. wc_get_image_size doesn't return an height for the woocommerce_single size. Further and since the image sizes are declared, there is no need to translate the size to an array.