Merge pull request #14013 from om4james/testsdeprecatedwarning
Avoid deprecated warning when creating an order in unit tests
This commit is contained in:
commit
bad16b47da
|
@ -57,7 +57,15 @@ class WC_Helper_Order {
|
|||
$order = wc_create_order( $order_data );
|
||||
|
||||
// Add order products
|
||||
$order->add_product( $product, 4 );
|
||||
$item = new WC_Order_Item_Product();
|
||||
$item->set_props( array(
|
||||
'product' => $product,
|
||||
'quantity' => 4,
|
||||
'subtotal' => wc_get_price_excluding_tax( $product, array( 'qty' => 4 ) ),
|
||||
'total' => wc_get_price_excluding_tax( $product, array( 'qty' => 4 ) ),
|
||||
) );
|
||||
$item->save();
|
||||
$order->add_item( $item );
|
||||
|
||||
// Set billing address
|
||||
$order->set_billing_first_name( 'Jeroen' );
|
||||
|
|
Loading…
Reference in New Issue