Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Oct 28, 2023
1 parent a837454 commit 4fbfc46
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Interfaces/Inventoryable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function getFormattedWeight(): ?string;
*/
public function isVirtual(): bool;

/**
* Determine if the stockable model is physical.
*/
public function isPhysical(): bool;

/**
* Determine if the stockable model is downloadable.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/InteractsWithItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function needsShipping(): bool
{
return $this->items->some(static function (Item $item): bool {
return $item->buyable instanceof Inventoryable
&& $item->buyable->isVirtual();
&& $item->buyable->isPhysical();
});
}

Expand Down
8 changes: 8 additions & 0 deletions src/Traits/InteractsWithStock.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public function isVirtual(): bool
return ! is_null($meta) && (bool) $meta->value;
}

/**
* Determine if the stockable model is physical.
*/
public function isPhysical(): bool
{
return ! $this->isVirtual();
}

/**
* Determine if the stockable model is downloadable.
*/
Expand Down

0 comments on commit 4fbfc46

Please sign in to comment.