Skip to content

Commit e79edf3

Browse files
author
Sergiu Cazac
committed
PriceRules and Discounts resources added
1 parent 53b34a7 commit e79edf3

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

lib/DiscountCode.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Sergiu Cazac <kilobyte2007@gmail.com>
5+
* Created at 5/06/19 2:09 AM UTC+03:00
6+
*
7+
* @see https://help.shopify.com/api/reference/discounts/discountcode Shopify API Reference for PriceRule
8+
*/
9+
10+
namespace PHPShopify;
11+
12+
13+
class DiscountCode extends ShopifyResource
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
protected $resourceKey = 'discount_code';
19+
}

lib/PriceRule.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* @author Sergiu Cazac <kilobyte2007@gmail.com>
5+
* Created at 5/06/19 2:06 AM UTC+03:00
6+
*
7+
* @see https://help.shopify.com/api/reference/discounts/pricerule Shopify API Reference for PriceRule
8+
*/
9+
10+
namespace PHPShopify;
11+
12+
13+
/*
14+
* --------------------------------------------------------------------------
15+
* PriceRule -> Child Resources
16+
* --------------------------------------------------------------------------
17+
* @property-read ShopifyResource $DiscountCode
18+
*
19+
* @method ShopifyResource DiscountCode(integer $id = null)
20+
*
21+
*/
22+
class PriceRule extends ShopifyResource
23+
{
24+
/**
25+
* @inheritDoc
26+
*/
27+
public $resourceKey = 'price_rule';
28+
29+
/**
30+
* @inheritDoc
31+
*/
32+
public $countEnabled = false;
33+
34+
/**
35+
* @inheritDoc
36+
*/
37+
protected $childResource = array(
38+
'DiscountCode'
39+
);
40+
}

lib/ShopifySDK.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class ShopifySDK
112112
'Policy',
113113
'Product',
114114
'ProductVariant',
115+
'PriceRule',
115116
'RecurringApplicationCharge',
116117
'Redirect',
117118
'ScriptTag',
@@ -137,6 +138,7 @@ class ShopifySDK
137138
'OrderRisk' => 'Order',
138139
'ProductImage' => 'Product',
139140
'ProductVariant' => 'Product',
141+
'DiscountCode' => 'PriceRule',
140142
'Province' => 'Country',
141143
'Refund' => 'Order',
142144
'Transaction' => 'Order',

0 commit comments

Comments
 (0)