Skip to content

Commit 8c3caf7

Browse files
authored
Merge pull request #68 from chiwek/master
Added collection metafield API calls
2 parents 893cf91 + 7a142e0 commit 8c3caf7

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

src/resources/metafield.php

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,53 @@
291291
),
292292

293293

294+
295+
/**
296+
* createCollectionMetafield() method
297+
*
298+
* reference: https://help.shopify.com/api/reference/metafield
299+
*/
300+
"createCollectionMetafield" => array(
301+
"httpMethod" => "POST",
302+
"uri" => "/admin/collections/{id}/metafields.json",
303+
"summary" => "Create a new metafield for a collection",
304+
"responseModel" => "defaultJsonResponse",
305+
"parameters" => array(
306+
"id" => array(
307+
"type" => "number",
308+
"location" => "uri",
309+
"description" => "The ID of the Collection.",
310+
"required" => true
311+
),
312+
"metafield" => array(
313+
"location" => "json",
314+
"parameters" => array(
315+
"namespace" => array(
316+
"type" => "string",
317+
"location" => "json",
318+
"description" => "The Namespace for the Metafield."
319+
),
320+
"key" => array(
321+
"type" => "string",
322+
"location" => "json",
323+
"description" => "The Key for the Metafield."
324+
),
325+
"value" => array(
326+
"type" => "string",
327+
"location" => "json",
328+
"description" => "The Value of the Metafield."
329+
),
330+
"value_type" => array(
331+
"type" => "string",
332+
"location" => "json",
333+
"description" => "The Value Type of the Metafield."
334+
)
335+
)
336+
)
337+
)
338+
),
339+
340+
294341
/**
295342
* createProductMetafield() method
296343
*
@@ -424,6 +471,54 @@
424471
),
425472

426473

474+
475+
/**
476+
* updateCollectionMetafield() method
477+
*
478+
* reference: https://help.shopify.com/api/reference/metafield
479+
*/
480+
"updateCollectionMetafield" => array(
481+
"httpMethod" => "PUT",
482+
"uri" => "/admin/collections/{id}/metafields/{metafield_id}.json",
483+
"summary" => "Update a Collection Metafield",
484+
"responseModel" => "defaultJsonResponse",
485+
"parameters" => array(
486+
"id" => array(
487+
"type" => "number",
488+
"location" => "uri",
489+
"description" => "The ID of the Collection.",
490+
"required" => true
491+
),
492+
"metafield_id" => array(
493+
"type" => "number",
494+
"location" => "uri",
495+
"description" => "The ID of the Metafield.",
496+
"required" => true
497+
),
498+
"metafield" => array(
499+
"location" => "json",
500+
"parameters" => array(
501+
"metafieldId" => array(
502+
"type" => "number",
503+
"location" => "json",
504+
"description" => "The ID for the Metafield."
505+
),
506+
"value" => array(
507+
"type" => "string",
508+
"location" => "json",
509+
"description" => "The Value of the Metafield."
510+
),
511+
"value_type" => array(
512+
"type" => "string",
513+
"location" => "json",
514+
"description" => "The Value Type of the Metafield."
515+
)
516+
)
517+
)
518+
)
519+
),
520+
521+
427522
/**
428523
* updateProductMetafield() method
429524
*
@@ -538,6 +633,31 @@
538633
)
539634
),
540635

636+
/**
637+
* deleteCollectionMetafield() method
638+
*
639+
* reference: https://help.shopify.com/api/reference/metafield
640+
*/
641+
"deleteCollectionMetafield" => array(
642+
"httpMethod" => "DELETE",
643+
"uri" => "/admin/collections/{id}/metafields/{metafieldId}.json",
644+
"summary" => "Delete a Collection Metafield",
645+
"responseModel" => "defaultJsonResponse",
646+
"parameters" => array(
647+
"id" => array(
648+
"type" => "number",
649+
"location" => "uri",
650+
"description" => "The ID of the Product.",
651+
"required" => true
652+
),
653+
"metafieldId" => array(
654+
"type" => "number",
655+
"location" => "uri",
656+
"description" => "The ID of the Metafield.",
657+
"required" => true
658+
)
659+
)
660+
),
541661

542662
/**
543663
* deleteProductMetafield() method

0 commit comments

Comments
 (0)