Skip to content

Commit

Permalink
Fix an error when creating custom line items
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Oct 12, 2024
1 parent 8ed3a16 commit bca2c69
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/services/Codes.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use craft\models\FieldLayout;

use craft\commerce\elements\Order;
use craft\commerce\enums\LineItemType;
use craft\commerce\models\LineItem;

use yii\base\Component;
Expand Down Expand Up @@ -242,6 +243,11 @@ public function handleValidateLineItem(ModelEvent $event): void
{
/** @var LineItem $lineItem */
$lineItem = $event->sender;

if ($lineItem->type === LineItemType::Custom) {
return;
}

$purchasable = $lineItem->getPurchasable();

// make sure it's a Voucher
Expand Down

0 comments on commit bca2c69

Please sign in to comment.