From 473a3fca21f96074f9aebd38332f1d923587a372 Mon Sep 17 00:00:00 2001 From: Steffen Persch Date: Sun, 25 Oct 2020 18:04:22 +0100 Subject: [PATCH] Support DiscountCode batch Action --- lib/Batch.php | 33 +++++++++++++++++++++++++++++++++ lib/PriceRule.php | 6 ++++-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 lib/Batch.php diff --git a/lib/Batch.php b/lib/Batch.php new file mode 100644 index 0000000..49e125b --- /dev/null +++ b/lib/Batch.php @@ -0,0 +1,33 @@ + 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]; + } + +} diff --git a/lib/PriceRule.php b/lib/PriceRule.php index ab77a4e..15c77a9 100644 --- a/lib/PriceRule.php +++ b/lib/PriceRule.php @@ -17,6 +17,7 @@ * @property-read ShopifyResource $DiscountCode * * @method ShopifyResource DiscountCode(integer $id = null) + * @method ShopifyResource Batch() * */ class PriceRule extends ShopifyResource @@ -30,6 +31,7 @@ class PriceRule extends ShopifyResource * @inheritDoc */ protected $childResource = array( - 'DiscountCode' + 'DiscountCode', + 'Batch', ); -} \ No newline at end of file +}