woocommerce_add_order_item_meta($item_id, '_deposit_full_amount_ex_tax', $item['line_total']); if ('plan' === WC_Deposits_Product_Manager::get_deposit_type($item['product_id'])) { $plan_id = current(WC_Deposits_Plans_Manager::get_plan_ids_for_product($item['product_id'])); woocommerce_add_order_item_meta($item_id, '_payment_plan', $plan_id); } else { $plan_id = 0; } // Change line item costs $deposit_amount = WC_Deposits_Product_Manager::get_deposit_amount($product, $plan_id, 'order', $item['line_total']); wc_update_order_item_meta($item_id, '_line_total', $deposit_amount); wc_update_order_item_meta($item_id, '_line_subtotal', $deposit_amount); } } /** * Should the order stock be reduced? * @return bool */ public function allow_reduce_order_stock($allowed, $order) { if (is_numeric($order)) { $order = wc_get_order($order); } // Don't reduce stock on follow up orders if ('wc_deposits' === $order->created_via) { $allowed = false; } return $allowed; } } WC_Deposits_Order_Manager::get_instance();