Skip to content

Commit

Permalink
Disable payment status column for automatic payments
Browse files Browse the repository at this point in the history
  • Loading branch information
inpsyde-maticluznar committed Feb 6, 2024
1 parent 0d65130 commit af2cdc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/MerchantCapture/MerchantCaptureModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
10 changes: 9 additions & 1 deletion src/MerchantCapture/OrderListPaymentColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;

Expand Down

0 comments on commit af2cdc4

Please sign in to comment.