Merge pull request #3569 from thenbrent/non_static_variable_product_sync

Backward compatible variable_product_sync()
This commit is contained in:
Mike Jolley 2013-08-02 03:09:04 -07:00
commit a5760fc19b
2 changed files with 14 additions and 2 deletions

View File

@ -829,7 +829,7 @@ function process_product_meta_variable( $post_id ) {
}
// Update parent if variable so price sorting works and stays in sync with the cheapest child
WC_Product_Variable::variable_product_sync( $post_id );
WC_Product_Variable::sync( $post_id );
// Update default attribute options setting
$default_attributes = array();

View File

@ -463,7 +463,19 @@ class WC_Product_Variable extends WC_Product {
/**
* Sync variable product prices with the children lowest/highest prices.
*/
public static function variable_product_sync( $product_id ) {
public function variable_product_sync( $product_id = '' ) {
if ( empty( $product_id ) )
$product_id = $this->id;
self::sync( $product_id );
}
/**
* Sync variable product prices with the children lowest/highest prices.
*/
public static function sync( $product_id ) {
$children = get_posts( array(
'post_parent' => $product_id,
'posts_per_page'=> -1,