/**
  * Gets the identified product. Compatible with WC 2.0 and backwards
  * compatible with previous versions
  *
  * @param int $product_id the product identifier
  * @param array $args optional array of arguments
  *
  * @return WC_Product the product
  */
 public function get_product($product_id, $args = array())
 {
     $product = null;
     if (version_compare(WOOCOMMERCE_VERSION, "2.0.0") >= 0) {
         // WC 2.0
         $product = get_product($product_id, $args);
     } else {
         // old style, get the product or product variation object
         if (isset($args['parent_id']) && $args['parent_id']) {
             $product = new WC_Product_Variation($product_id, $args['parent_id']);
         } else {
             // get the regular product, but if it has a parent, return the product variation object
             $product = new WC_Product($product_id);
             if ($product->get_parent()) {
                 $product = new WC_Product_Variation($product->id, $product->get_parent());
             }
         }
     }
     return $product;
 }