Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit cd31cd8

Browse files
committed
Update Shopify.php
1 parent ca330c0 commit cd31cd8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Mochaka/Shopify/Shopify.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,20 @@ public function updateVariant($variantId, $data)
177177
return $this->makeRequest('PUT', 'variants/' . $variantId . '.json', $d);
178178
}
179179

180+
/**
181+
* creates a variant for the specific shopify id
182+
*
183+
* @param $shopifyId
184+
* @param $data
185+
*
186+
* @return array
187+
*/
188+
public function createVariant($shopifyId, $data)
189+
{
190+
$d['variant'] = (!isset($data['variant'])) ? $data : $data['variant'];
191+
return $this->makeRequest('POST', 'products/' . $shopifyId . '/variants.json', $d);
192+
}
193+
180194
/**
181195
* Delete's a variant from shopify
182196
*

0 commit comments

Comments
 (0)