Skip to content

Commit 27ccacf

Browse files
authored
Merge pull request #204 from whobutsb/master
Added the Cart Resource
2 parents 05eb123 + a421436 commit 27ccacf

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ Some resources are available directly, some resources are only available through
302302
- Blog -> Article -> [Metafield](https://help.shopify.com/api/reference/metafield)
303303
- Blog -> [Event](https://help.shopify.com/api/reference/event/)
304304
- Blog -> [Metafield](https://help.shopify.com/api/reference/metafield)
305-
- [CarrierService](https://help.shopify.com/api/reference/carrierservice/)
305+
- [CarrierService](https://help.shopify.com/api/reference/carrierservice/)-
306+
- [Cart](https://shopify.dev/docs/themes/ajax-api/reference/cart) (read only)
306307
- [Collect](https://help.shopify.com/api/reference/collect/)
307308
- [Comment](https://help.shopify.com/api/reference/comment/)
308309
- Comment -> [Event](https://help.shopify.com/api/reference/event/)

lib/Cart.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace PHPShopify;
4+
5+
/* @see https://shopify.dev/docs/themes/ajax-api/reference/cart */
6+
use PHPShopify\ShopifyResource;
7+
8+
class Cart extends ShopifyResource {
9+
10+
/**
11+
* @inheritDoc
12+
*/
13+
protected $resourceKey ='cart';
14+
15+
/**
16+
* @inheritDoc
17+
*/
18+
public $searchEnabled = false;
19+
20+
/**
21+
* @inheritDoc
22+
*/
23+
public $readOnly = true;
24+
}

lib/ShopifySDK.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
* @property-read ApplicationCharge $ApplicationCharge
7272
* @property-read Blog $Blog
7373
* @property-read CarrierService $CarrierService
74+
* @property-read Cart $Cart
7475
* @property-read Collect $Collect
7576
* @property-read Collection $Collection
7677
* @property-read Comment $Comment
@@ -115,6 +116,7 @@
115116
* @method ApplicationCharge ApplicationCharge(integer $id = null)
116117
* @method Blog Blog(integer $id = null)
117118
* @method CarrierService CarrierService(integer $id = null)
119+
* @method Cart Cart(string $cart_token = null)
118120
* @method Collect Collect(integer $id = null)
119121
* @method Collection Collection(integer $id = null)
120122
* @method Comment Comment(integer $id = null)
@@ -167,6 +169,7 @@ class ShopifySDK
167169
'ApplicationCharge',
168170
'Blog',
169171
'CarrierService',
172+
'Cart',
170173
'Collect',
171174
'Collection',
172175
'Comment',

0 commit comments

Comments
 (0)