From dc1798f942ca054e6c4500eb43387a11757747ed Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 13 Aug 2015 23:35:41 +0100 Subject: [PATCH] woocommerce_variable_children_args hook. --- includes/class-wc-product-variable.php | 5 ++++- readme.txt | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/class-wc-product-variable.php b/includes/class-wc-product-variable.php index e16a656513f..730064dc976 100644 --- a/includes/class-wc-product-variable.php +++ b/includes/class-wc-product-variable.php @@ -146,6 +146,7 @@ class WC_Product_Variable extends WC_Product { 'post_status' => 'publish', 'numberposts' => -1 ); + if ( $visible_only ) { $args['meta_query'] = array( 'relation' => 'AND', @@ -166,7 +167,9 @@ class WC_Product_Variable extends WC_Product { } } - $this->children[ $key ] = get_posts( apply_filters('woocommerce_variable_children_args', $args, $this, $visible_only ) ); + $args = apply_filters( 'woocommerce_variable_children_args', $args, $this, $visible_only ); + $this->children[ $key ] = get_posts( $args ); + set_transient( $transient_name, $this->children, DAY_IN_SECONDS * 30 ); } diff --git a/readme.txt b/readme.txt index 4fa5f00322f..3a951739f2f 100644 --- a/readme.txt +++ b/readme.txt @@ -163,6 +163,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Fix - Run html_entity_decode over text attributes to fix problems with quote characters. * Tweak - Order variations by menu_order by fallback to ID. * Tweak - Include attribute archives support in the breadcrumbs. +* Tweak - woocommerce_variable_children_args hook. = 2.4.3 - 12/08/2015 = * Fix - Query within wc_customer_bought_product().