From d7f1571e09a229782f83067e2a0ce5efe53df33a Mon Sep 17 00:00:00 2001 From: Bastian de Byl Date: Fri, 12 May 2023 15:20:36 -0400 Subject: [PATCH] main added CustomFields to snipcart product --- snipcart/snipcart.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/snipcart/snipcart.go b/snipcart/snipcart.go index c076190..824e052 100644 --- a/snipcart/snipcart.go +++ b/snipcart/snipcart.go @@ -127,14 +127,27 @@ type SnipcartProductVariant struct { AllowBackorder bool `json:"allowOutOfStockPurchases"` } +type SnipcartProductCustomField struct { + Name string `json:"name"` + Placeholder string `json:"placeholder"` + DisplayValue string `json:"displayValue"` + Type string `json:"type"` + Options string `json:"options"` + Required bool `json:"required"` + Value string `json:"value"` + Operation int `json:"operation"` + OptionsArray []string `json:"optionsArray"` +} + type SnipcartProduct struct { - Token string `json:"id"` - Id string `json:"userDefinedId"` - Name string `json:"name"` - Stock int `json:"stock"` - TotalStock int `json:"totalStock"` - AllowBackorder bool `json:"allowOutOfStockPurchases"` - Variants []SnipcartProductVariant `json:"variants"` + Token string `json:"id"` + Id string `json:"userDefinedId"` + Name string `json:"name"` + Stock int `json:"stock"` + TotalStock int `json:"totalStock"` + AllowBackorder bool `json:"allowOutOfStockPurchases"` + CustomFields []SnipcartProductCustomField `json:"customFields"` + Variants []SnipcartProductVariant `json:"variants"` } type SnipcartProductsResponse struct {