Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Nov 22, 2024
1 parent 63dd615 commit 0535547
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/Orders/LineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use DuncanMcClean\SimpleCommerce\Contracts\Product;
use DuncanMcClean\SimpleCommerce\Facades\Product as ProductFacade;
use Statamic\Support\Blink;
use Statamic\Support\Traits\FluentlyGetsAndSets;

class LineItem
Expand Down Expand Up @@ -40,7 +41,7 @@ public function product($product = null)
{
return $this
->fluentlyGetOrSet('product')
->setter(function ($product) {
->getter(function ($product) {
if ($product instanceof Product) {
return $product;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Orders/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function customer($customer = null)
{
return $this
->fluentlyGetOrSet('customer')
->setter(function ($value) {
->getter(function ($value) {
if (! $value) {
return null;
}
Expand Down
7 changes: 2 additions & 5 deletions src/Products/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,11 @@ public function taxCategory($taxCategory = null)
{
return $this
->fluentlyGetOrSet('taxCategory')
->getter(function ($value) {
if (! $value) {
->getter(function ($taxCategory) {
if (! $taxCategory) {
return TaxCategoryFacade::find('default');
}

return $value;
})
->setter(function ($taxCategory) {
if ($taxCategory instanceof TaxCategory) {
return $taxCategory;
}
Expand Down

0 comments on commit 0535547

Please sign in to comment.