Skip to content

Commit

Permalink
Add order state config options
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Sep 12, 2024
1 parent 1f27f47 commit 2eaaf48
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Config/Source/OrderStateOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php declare(strict_types=1);

namespace Yireo\GoogleTagManager2\Config\Source;

use Magento\Framework\Data\OptionSourceInterface;
use Magento\Sales\Model\Order;

class OrderStateOptions implements OptionSourceInterface
{

public function toOptionArray()
{
$options = [];
foreach ($this->getStates() as $state) {
$options[] = ['value' => $state, 'label' => $state];
}

return $options;
}

private function getStates(): array
{
return [
Order::STATE_NEW,
Order::STATE_PAYMENT_REVIEW,
Order::STATE_PENDING_PAYMENT,
Order::STATE_PROCESSING,
Order::STATE_COMPLETE,
Order::STATE_CANCELED,
Order::STATE_CLOSED,
Order::STATE_HOLDED,
];
}
}

0 comments on commit 2eaaf48

Please sign in to comment.