Skip to content

Commit bbc60ce

Browse files
committed
Replace ShippingZoneMethod instead of ShippingMethod
1 parent df4e534 commit bbc60ce

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"Report": "Codexshaper\\WooCommerce\\Models\\Report",
4444
"Review": "Codexshaper\\WooCommerce\\Models\\Review",
4545
"Setting": "Codexshaper\\WooCommerce\\Models\\Setting",
46-
"ShippingMethod": "Codexshaper\\WooCommerce\\Models\\ShippingMethod",
4746
"ShippingZone": "Codexshaper\\WooCommerce\\Models\\ShippingZone",
47+
"ShippingZoneMethod": "Codexshaper\\WooCommerce\\Models\\ShippingZoneMethod",
4848
"System": "Codexshaper\\WooCommerce\\Models\\System",
4949
"Tag": "Codexshaper\\WooCommerce\\Models\\Tag",
5050
"Tax": "Codexshaper\\WooCommerce\\Models\\Tax",

src/Facades/ShippingZoneMethod.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace Codexshaper\WooCommerce\Facades;
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class ShippingZoneMethod extends Facade
7+
{
8+
/**
9+
* Get the registered name of the component.
10+
*
11+
* @return string
12+
*/
13+
protected static function getFacadeAccessor()
14+
{
15+
return 'Codexshaper\WooCommerce\Models\ShippingZoneMethod';
16+
}
17+
}

src/Models/ShippingZoneMethod.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Codexshaper\WooCommerce\Models;
4+
5+
use Codexshaper\WooCommerce\Facades\WooCommerce;
6+
7+
class ShippingZoneMethod extends BaseModel
8+
{
9+
protected $endpoint = 'shipping_methods';
10+
11+
/**
12+
* Retrieve all Items
13+
*
14+
* @param array $options
15+
*
16+
* @return array
17+
*/
18+
protected function all($options = [])
19+
{
20+
return WooCommerce::all($this->endpoint, $options);
21+
}
22+
23+
/**
24+
* Retrieve single Item
25+
*
26+
* @param integer $id
27+
* @param array $options
28+
*
29+
* @return object
30+
*/
31+
protected function find($id, $options = [])
32+
{
33+
return collect(WooCommerce::find("{$this->endpoint}/{$id}", $options));
34+
}
35+
}

0 commit comments

Comments
 (0)