Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request phpclassic#188 from n3o77/master
Browse files Browse the repository at this point in the history
Support DiscountCode batch Action
  • Loading branch information
tareqtms authored Dec 5, 2020
2 parents d06cb86 + 473a3fc commit 79df85f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
33 changes: 33 additions & 0 deletions lib/Batch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* @see https://help.shopify.com/api/reference/discounts/discountcode Shopify API Reference for PriceRule
*/

namespace PHPShopify;


/**
* --------------------------------------------------------------------------
* DiscountCode -> Batch action
* --------------------------------------------------------------------------
*
*/

class Batch extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'batch';

protected function getResourcePath()
{
return $this->resourceKey;
}

protected function wrapData($dataArray, $dataKey = null)
{
return ['discount_codes' => $dataArray];
}

}
6 changes: 4 additions & 2 deletions lib/PriceRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @property-read ShopifyResource $DiscountCode
*
* @method ShopifyResource DiscountCode(integer $id = null)
* @method ShopifyResource Batch()
*
*/
class PriceRule extends ShopifyResource
Expand All @@ -30,6 +31,7 @@ class PriceRule extends ShopifyResource
* @inheritDoc
*/
protected $childResource = array(
'DiscountCode'
'DiscountCode',
'Batch',
);
}
}

0 comments on commit 79df85f

Please sign in to comment.