/**
  * Initialize invoice with WooCommerce order
  * @param string $order
  */
 public function __construct($order_id, $type, $taxes_count = 0)
 {
     parent::__construct();
     $this->order = wc_get_order($order_id);
     $this->type = $type;
     $this->columns_count = $this->get_columns_count($taxes_count);
     $this->formatted_number = get_post_meta($this->order->id, '_bewpi_formatted_invoice_number', true);
     $this->template_name = $this->template_options["bewpi_template_name"];
     // Check if the invoice already exists.
     if (!empty($this->formatted_number) || isset($_GET['bewpi_action']) && $_GET['bewpi_action'] !== 'cancel') {
         $this->init();
     }
 }