Skip to content

Commit ad0807a

Browse files
[6.x] Fix shipping method fieldtype (#1028)
* Fix shipping method fieldtype * Fix tests
1 parent 06d4c0d commit ad0807a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Fieldtypes/ShippingMethodFieldtype.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function toItemArray($value)
6060
$site = Site::selected();
6161

6262
$shippingMethod = SimpleCommerce::shippingMethods($site->handle())
63-
->where('class', $value)
63+
->where('handle', $value)
6464
->first();
6565

6666
if (! $shippingMethod) {
@@ -83,7 +83,7 @@ public function preProcessIndex($data)
8383
$site = Site::selected();
8484

8585
$shippingMethod = SimpleCommerce::shippingMethods($site->handle())
86-
->where('class', $item)
86+
->where('handle', $item)
8787
->first();
8888

8989
if (! $shippingMethod) {

tests/Fieldtypes/ShippingMethodFieldtypeTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
});
4141

4242
test('can return as item array', function () {
43-
$toItemArray = $this->fieldtype->toItemArray(FreeShipping::class);
43+
$toItemArray = $this->fieldtype->toItemArray(FreeShipping::handle());
4444

4545
expect($toItemArray)->toBeArray();
4646

@@ -51,7 +51,7 @@
5151
});
5252

5353
test('can preprocess index', function () {
54-
$preProcessIndex = $this->fieldtype->preProcessIndex(FreeShipping::class);
54+
$preProcessIndex = $this->fieldtype->preProcessIndex(FreeShipping::handle());
5555

5656
expect($preProcessIndex)->toBeString();
5757
expect('Free Shipping')->toBe($preProcessIndex);

0 commit comments

Comments
 (0)