diff --git a/src/MerchantCapture/MerchantCaptureModule.php b/src/MerchantCapture/MerchantCaptureModule.php index a3177f88..be048776 100644 --- a/src/MerchantCapture/MerchantCaptureModule.php +++ b/src/MerchantCapture/MerchantCaptureModule.php @@ -246,7 +246,7 @@ static function ($disableShipAndCapture, WC_Order $order) use ($container) { 10, 2 ); - new OrderListPaymentColumn(); + new OrderListPaymentColumn($container); new ManualCapture($container); new StateChangeCapture($container); }); diff --git a/src/MerchantCapture/OrderListPaymentColumn.php b/src/MerchantCapture/OrderListPaymentColumn.php index d74a9173..427ab7c9 100644 --- a/src/MerchantCapture/OrderListPaymentColumn.php +++ b/src/MerchantCapture/OrderListPaymentColumn.php @@ -6,11 +6,15 @@ use Automattic\WooCommerce\Admin\Overrides\Order; use Mollie\WooCommerce\MerchantCapture\UI\StatusRenderer; +use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; class OrderListPaymentColumn { - public function __construct() + /** @var ContainerInterface $container */ + private $container; + public function __construct($container) { + $this->container = $container; add_filter('manage_edit-shop_order_columns', [$this, 'renderColumn']); add_action('manage_shop_order_posts_custom_column', [$this, 'renderColumnValue'], 10, 2); @@ -23,6 +27,10 @@ public function __construct() public function renderColumn(array $columns): array { + if (!$this->container->get('merchant.manual_capture.enabled')) { + return $columns; + } + $newColumns = []; $mollieColumnAdded = false;