Хорошо, читая об изменениях в WooCommerce 3. 0+, кажется, что вы больше не можете напрямую обращаться к этому классу, поэтому я предположил бы, что этот код нужно изменить, так как он выдает ошибку:
$order_item_id = 15;
$order_item = new WC_Order_Item_Product($order_item_id);
$return = $order_item->get_id() ? $order_item : false;
Но, смущающе, я не уверен, как изменить этот код, чтобы использовать правильные новые функции получения и установки в самой новой версии этого класса, которая больше не имеет конструкции. Как это сделать правильно? Я не вижу функции get
для получения элемента заказа таким же образом, как указано выше.
https://docs.woocommerce.com/wc-apidocs/class-WC_Order_Item_Product.html
Может быть, я что-то упускаю здесь?