Use wc_get_order to retrieve the order

This commit is contained in:
Emili Castells Guasch 2024-07-02 11:19:59 +02:00
parent ee3bff88bc
commit ab02026816

View file

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\WcGateway\Admin; namespace WooCommerce\PayPalCommerce\WcGateway\Admin;
use WC_Order;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
/** /**
@ -38,7 +39,10 @@ class PaymentStatusOrderDetail {
* @param int $wc_order_id The WooCommerce order id. * @param int $wc_order_id The WooCommerce order id.
*/ */
public function render( int $wc_order_id ) { public function render( int $wc_order_id ) {
$wc_order = new \WC_Order( $wc_order_id ); $wc_order = wc_get_order( $wc_order_id );
if ( ! $wc_order instanceof WC_Order ) {
return;
}
if ( ! $this->column->should_render_for_order( $wc_order ) || $this->column->is_captured( $wc_order ) ) { if ( ! $this->column->should_render_for_order( $wc_order ) || $this->column->is_captured( $wc_order ) ) {
return; return;