Skip to content

Commit

Permalink
Adding better weight control
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoxavier committed Mar 3, 2020
1 parent 349105a commit 170506f
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src/Controllers/OrderProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class OrderProduct

/** @var int */
private $warehouse_id = 0;

/** @var bool */
private $hasIVA = false;

Expand Down Expand Up @@ -109,6 +109,33 @@ public function setSummary($summary = null)
$this->summary .= $this->getSummaryExtraProductOptions();
}

$meta_data = $this->product->get_formatted_meta_data('');
$hidden_order_itemmeta = apply_filters(
'woocommerce_hidden_order_itemmeta',
array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost',
'_reduced_stock',
)
);

if ($meta_data) {
foreach ($meta_data as $meta_id => $meta) {
if (in_array( $meta->key, $hidden_order_itemmeta, true)) {
continue;
}
$this->summary .= trim($meta->display_key) . ': ' . trim(strip_tags($meta->display_value)) . "\n";
}
}

return $this;
}

Expand Down Expand Up @@ -254,7 +281,7 @@ private function setTaxes()
private function setTax($taxRate)
{
$moloniTax = Tools::getTaxFromRate((float)$taxRate);

$tax = [];
$tax['tax_id'] = $moloniTax['tax_id'];
$tax['value'] = $taxRate;
Expand Down Expand Up @@ -305,4 +332,4 @@ public function mapPropsToValues()

return $values;
}
}
}

0 comments on commit 170506f

Please sign in to comment.