Fix broken counting of orders inside order project

This commit is contained in:
Almira Krdzic
2018-09-24 22:19:21 +02:00
parent 11c26aeee1
commit fdc01b974e
2 changed files with 38 additions and 8 deletions

View File

@@ -31,11 +31,23 @@ class Wiaas_Order_Project {
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'shop_order_project' ),
'update_count_callback' => array(__CLASS__, 'update_count_callback')
);
register_taxonomy( 'shop_order_project', array( 'shop_order' ), $args );
}
/**
* Callback to handle counting of number of orders inside every project
* This does not work out of the box for orders since they are marked as private post type
*
* @param array $project_ids
*/
public static function update_count_callback($project_ids) {
// Update counts
_update_generic_term_count( $project_ids, get_taxonomy('shop_order_project') );
}
/**
* Retrieves available order projects
* @return array List of available order projects