I'm trying to fix some deprecated functions from this <a href="https://wordpress.org/plugins/sagepay-direct-gateway-for-woocommerce/" rel="nofollow noreferrer">unsupported SagePay plugin</a>.
How can I replace the following snippet of deprecated code in WooCommerce?
I can see that this is its replacement:
<blockquote>
@deprecated Add deprecation notices in future release. Replaced with
</blockquote>
But simply changing it to
doesn't work. I've also tried changing that line to:
But it causes an internal server error during the checkout.
How can I replace the following snippet of deprecated code in WooCommerce?
Code:
foreach ($order->get_items() as $item) {
if ($item['qty']) {
$product = $order->get_product_from_item($item);
I can see that this is its replacement:
<blockquote>
@deprecated Add deprecation notices in future release. Replaced with
Code:
$item->get_product()
But simply changing it to
Code:
$product = $item->get_product();
Code:
$product = wc_get_product($item['id']);
But it causes an internal server error during the checkout.