Skip to content

Commit

Permalink
Fix item data
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Aug 17, 2016
1 parent 0b9a599 commit 3755049
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion includes/class-wc-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function create_order() {
foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
$product = $values['data'];
$item = new WC_Order_Item_Product( array(
'qty' => $values['quantity'],
'quantity' => $values['quantity'],
'name' => $product ? $product->get_title() : '',
'tax_class' => $product ? $product->get_tax_class() : '',
'product_id' => $product ? $product->get_id() : '',
Expand Down
8 changes: 8 additions & 0 deletions includes/class-wc-order-item-fee.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ public function save() {
return $this->get_id();
}

/**
* Internal meta keys we don't want exposed as part of meta_data.
* @return array()
*/
protected function get_internal_meta_keys() {
return array( '_tax_class', '_tax_status', '_line_subtotal', '_line_subtotal_tax', '_line_total', '_line_tax', '_line_tax_data' );
}

/*
|--------------------------------------------------------------------------
| Setters
Expand Down
19 changes: 0 additions & 19 deletions includes/class-wc-order-item-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,25 +222,6 @@ public function set_backorder_meta() {
}
}

/**
* Get all class data in array format.
* @since 2.7.0
* @return array
*/
public function get_data() {
return array_merge(
$this->_data,
array(
// Return SKU for convenience
'sku' => $this->get_product() ? $this->get_product()->get_sku(): null,

// Return item price for convenience
'price' => $this->get_total() / max( 1, $this->get_quantity() ),
'meta_data' => $this->get_meta_data(),
)
);
}

/*
|--------------------------------------------------------------------------
| Setters
Expand Down

0 comments on commit 3755049

Please sign in to comment.