shopify

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 16 Imported by: 0

README

go-shopify-graphql

A simple Shopify client using the Shopify's GraphQL Admin API.

Getting started

A Hello World example

0. Setup
export STORE_API_KEY=<private_app_api_key>
export STORE_PASSWORD=<private_app_password>
export STORE_NAME=<store_name>
1. Program
package main

import (
    "fmt"

    shopify "github.com/r0busta/go-shopify-graphql"
)

func main() {
    // Create client
    client := shopify.NewDefaultClient()

    // Get all collections
    collections, err := client.Collection.ListAll()
    if err != nil {
        panic(err)
    }

    // Print out the result
    for _, c := range collections {
        fmt.Println(c.Handle)
    }
}
3. Run
go run .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkOperationService added in v1.0.0

type BulkOperationService interface {
	BulkQuery(query string, v interface{}) error
}

type BulkOperationServiceOp added in v1.0.0

type BulkOperationServiceOp struct {
	// contains filtered or unexported fields
}

func (*BulkOperationServiceOp) BulkQuery added in v1.0.0

func (s *BulkOperationServiceOp) BulkQuery(query string, out interface{}) (err error)

type Client added in v1.0.0

type Client struct {
	Product       ProductService
	Variant       VariantService
	Collection    CollectionService
	Order         OrderService
	Metafield     MetafieldService
	BulkOperation BulkOperationService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string, password string, storeName string) *Client

func NewDefaultClient added in v1.0.0

func NewDefaultClient() (shopClient *Client)

func (*Client) GraphQLClient added in v1.2.0

func (c *Client) GraphQLClient() *graphql.Client

type Collection added in v1.0.0

type Collection struct {
	ID            graphql.ID     `json:"id,omitempty"`
	Handle        graphql.String `json:"handle,omitempty"`
	ProductsCount graphql.Int    `json:"productsCount,omitempty"`

	Products struct {
		Edges []ProductShortNode `json:"edges,omitempty"`
	} `graphql:"products(first: 100)" json:"products,omitempty"`
}

type CollectionCreate added in v1.0.0

type CollectionCreate struct {
	CollectionInput CollectionInput
}

type CollectionCreateResult added in v1.0.0

type CollectionCreateResult struct {
	Collection struct {
		ID graphql.ID `json:"id,omitempty"`
	}
	UserErrors []UserErrors
}

type CollectionInput added in v1.0.0

type CollectionInput struct {
	// The description of the collection, in HTML format.
	DescriptionHTML graphql.String `json:"descriptionHtml,omitempty"`

	// A unique human-friendly string for the collection. Automatically generated from the collection's title.
	Handle graphql.String `json:"handle,omitempty"`

	// Specifies the collection to update or create a new collection if absent.
	ID graphql.ID `json:"id,omitempty"`

	// The image associated with the collection.
	Image *ImageInput `json:"image,omitempty"`

	// The metafields to associate with this collection.
	Metafields []MetafieldInput `json:"metafields,omitempty"`

	// Initial list of collection products. Only valid with productCreate and without rules.
	Products []graphql.ID `json:"products,omitempty"`

	// Indicates whether a redirect is required after a new handle has been provided. If true, then the old handle is redirected to the new one automatically.
	RedirectNewHandle graphql.Boolean `json:"redirectNewHandle,omitempty"`

	//	The rules used to assign products to the collection.
	RuleSet *CollectionRuleSetInput `json:"ruleSet,omitempty"`

	// SEO information for the collection.
	SEO *SEOInput `json:"seo,omitempty"`

	// The order in which the collection's products are sorted.
	SortOrder *CollectionSortOrder `json:"sortOrder,omitempty"`

	// The theme template used when viewing the collection in a store.
	TemplateSuffix graphql.String `json:"templateSuffix,omitempty"`

	// Required for creating a new collection.
	Title graphql.String `json:"title,omitempty"`
}

type CollectionRuleColumn added in v1.0.0

type CollectionRuleColumn string

CollectionRuleColumn string enum VENDOR The vendor attribute. TAG The tag attribute. TITLE The title attribute. TYPE The type attribute. VARIANT_COMPARE_AT_PRICE The variant_compare_at_price attribute. VARIANT_INVENTORY The variant_inventory attribute. VARIANT_PRICE The variant_price attribute. VARIANT_TITLE The variant_title attribute. VARIANT_WEIGHT The variant_weight attribute. IS_PRICE_REDUCED The is_price_reduced attribute.

type CollectionRuleInput added in v1.0.0

type CollectionRuleInput struct {
	// The attribute that the rule focuses on (for example, title or product_type).
	Column CollectionRuleColumn `json:"column,omitempty"` // REQUIRED

	// The value that the operator is applied to (for example, Hats).
	Condition graphql.String `json:"condition,omitempty"` // REQUIRED

	// The type of operator that the rule is based on (for example, equals, contains, or not_equals).
	Relation CollectionRuleRelation `json:"relation,omitempty"` // REQUIRED
}

type CollectionRuleRelation added in v1.0.0

type CollectionRuleRelation string

CollectionRuleRelation enum STARTS_WITH The attribute starts with the condition. ENDS_WITH The attribute ends with the condition. EQUALS The attribute is equal to the condition. GREATER_THAN The attribute is greater than the condition. IS_NOT_SET The attribute is not set. IS_SET The attribute is set. LESS_THAN The attribute is less than the condition. NOT_CONTAINS The attribute does not contain the condition. NOT_EQUALS The attribute does not equal the condition. CONTAINS The attribute contains the condition.

type CollectionRuleSetInput added in v1.0.0

type CollectionRuleSetInput struct {
	// Whether products must match any or all of the rules to be included in the collection. If true, then products must match one or more of the rules to be included in the collection. If false, then products must match all of the rules to be included in the collection.
	AppliedDisjunctively graphql.Boolean `json:"appliedDisjunctively"` // REQUIRED

	// The rules used to assign products to the collection.
	Rules []CollectionRuleInput `json:"rules,omitempty"`
}

type CollectionService added in v1.0.0

type CollectionService interface {
	ListAll() ([]*Collection, error)

	Get(id graphql.ID) (*Collection, error)

	Create(collection *CollectionCreate) (graphql.ID, error)
	CreateBulk(collections []*CollectionCreate) error

	Update(collection *CollectionCreate) error
}

type CollectionServiceOp added in v1.0.0

type CollectionServiceOp struct {
	// contains filtered or unexported fields
}

func (*CollectionServiceOp) Create added in v1.0.0

func (s *CollectionServiceOp) Create(collection *CollectionCreate) (graphql.ID, error)

func (*CollectionServiceOp) CreateBulk added in v1.0.0

func (s *CollectionServiceOp) CreateBulk(collections []*CollectionCreate) error

func (*CollectionServiceOp) Get added in v1.0.1

func (*CollectionServiceOp) ListAll added in v1.0.0

func (s *CollectionServiceOp) ListAll() ([]*Collection, error)

func (*CollectionServiceOp) Update added in v1.1.0

func (s *CollectionServiceOp) Update(collection *CollectionCreate) error

type CollectionSortOrder added in v1.0.0

type CollectionSortOrder string

CollectionSortOrder enum PRICE_DESC By price, in descending order (highest - lowest). ALPHA_DESC Alphabetically, in descending order (Z - A). BEST_SELLING By best-selling products. CREATED By date created, in ascending order (oldest - newest). CREATED_DESC By date created, in descending order (newest - oldest). MANUAL In the order set manually by the merchant. PRICE_ASC By price, in ascending order (lowest - highest). ALPHA_ASC Alphabetically, in ascending order (A - Z).

type CreateMediaInput added in v1.0.0

type CreateMediaInput struct {
	Alt              graphql.String   `json:"alt,omitempty"`
	MediaContentType MediaContentType `json:"mediaContentType,omitempty"` // REQUIRED
	OriginalSource   graphql.String   `json:"originalSource,omitempty"`   // REQUIRED
}

type CurrencyCode added in v1.1.0

type CurrencyCode string

CurrencyCode enum USD United States Dollars (USD). EUR Euro GBP British Pound ... see more at https://shopify.dev/docs/admin-api/graphql/reference/common-objects/currencycode

type Customer added in v1.1.0

type Customer struct {
	ID               graphql.ID     `json:"id,omitempty"`
	LegacyResourceID graphql.String `json:"legacyResourceId,omitempty"`
}

type DateTime added in v1.1.0

type DateTime string

type Decimal added in v1.0.0

type Decimal string // Serialized decimal.Decimal

type ImageInput added in v1.0.0

type ImageInput struct {
	AltText graphql.String `json:"altText,omitempty"`
	ID      graphql.ID     `json:"id,omitempty"`
	Src     graphql.String `json:"src,omitempty"`
}

type InventoryItem added in v1.2.0

type InventoryItem struct {
	ID               graphql.ID     `json:"id,omitempty"`
	LegacyResourceID graphql.String `json:"legacyResourceId,omitempty"`
}

type InventoryItemInput added in v1.0.0

type InventoryItemInput struct {
	// Unit cost associated with the inventory item, the currency is the shop's default currency.
	Cost Decimal `json:"cost,omitempty"`
	// Whether the inventory item is tracked. If true, then inventory quantity changes are tracked by Shopify.
	Tracked graphql.Boolean `json:"tracked,omitempty"`
}

type InventoryLevelInput added in v1.0.0

type InventoryLevelInput struct {
	AvailableQuantity graphql.Int `json:"availableQuantity"`
	LocationID        graphql.ID  `json:"locationId"`
}

type LineItem added in v1.1.0

type LineItem struct {
	ID                     graphql.ID      `json:"id,omitempty"`
	Quantity               graphql.Int     `json:"quantity,omitempty"`
	Product                LineItemProduct `json:"product,omitempty"`
	Variant                LineItemVariant `json:"variant,omitempty"`
	OriginalUnitPriceSet   MoneyBag        `json:"originalUnitPriceSet,omitempty"`
	DiscountedUnitPriceSet MoneyBag        `json:"discountedUnitPriceSet,omitempty"`
}

type LineItemProduct added in v1.1.0

type LineItemProduct struct {
	ID               graphql.ID     `json:"id,omitempty"`
	LegacyResourceID graphql.String `json:"legacyResourceId,omitempty"`
}

type LineItemVariant added in v1.1.0

type LineItemVariant struct {
	ID               graphql.ID       `json:"id,omitempty"`
	LegacyResourceID graphql.String   `json:"legacyResourceId,omitempty"`
	SelectedOptions  []SelectedOption `json:"selectedOptions,omitempty"`
}

type MediaContentType added in v1.0.0

type MediaContentType string

MediaContentType enum EXTERNAL_VIDEO An externally hosted video. IMAGE A Shopify hosted image. MODEL_3D A 3d model. VIDEO A Shopify hosted video.

type Metafield added in v1.2.0

type Metafield struct {
	// The date and time when the metafield was created.
	CreatedAt DateTime `json:"createdAt,omitempty"`
	// The description of a metafield.
	Description graphql.String `json:"description,omitempty"`
	// Globally unique identifier.
	ID graphql.ID `json:"id,omitempty"`
	// The key name for a metafield.
	Key graphql.String `json:"key,omitempty"`
	// The ID of the corresponding resource in the REST Admin API.
	LegacyResourceID graphql.String `json:"legacyResourceId,omitempty"`
	// The namespace for a metafield.
	Namespace graphql.String `json:"namespace,omitempty"`
	// Owner type of a metafield visible to the Storefront API.
	OwnerType graphql.String `json:"ownerType,omitempty"`
	// The date and time when the metafield was updated.
	UpdatedAt DateTime `json:"updatedAt,omitempty"`
	// The value of a metafield.
	Value graphql.String `json:"value,omitempty"`
	// Represents the metafield value type.
	ValueType MetafieldValueType `json:"valueType,omitempty"`
}

type MetafieldDeleteInput added in v1.2.0

type MetafieldDeleteInput struct {
	// The ID of the metafield to delete.
	ID graphql.ID `json:"id,omitempty"`
}

type MetafieldInput added in v1.0.0

type MetafieldInput struct {
	ID        graphql.ID         `json:"id,omitempty"`
	Namespace graphql.String     `json:"namespace,omitempty"`
	Key       graphql.String     `json:"key,omitempty"`
	Value     graphql.String     `json:"value,omitempty"`
	ValueType MetafieldValueType `json:"valueType,omitempty"`
}

type MetafieldService added in v1.2.0

type MetafieldService interface {
	ListAllShopMetafields() ([]*Metafield, error)
	ListShopMetafieldsByNamespace(namespace string) ([]*Metafield, error)

	GetShopMetafieldByKey(namespace, key string) (Metafield, error)

	Delete(metafield MetafieldDeleteInput) error
	DeleteBulk(metafield []MetafieldDeleteInput) error
}

type MetafieldServiceOp added in v1.2.0

type MetafieldServiceOp struct {
	// contains filtered or unexported fields
}

func (*MetafieldServiceOp) Delete added in v1.2.0

func (s *MetafieldServiceOp) Delete(metafield MetafieldDeleteInput) error

func (*MetafieldServiceOp) DeleteBulk added in v1.2.0

func (s *MetafieldServiceOp) DeleteBulk(metafields []MetafieldDeleteInput) error

func (*MetafieldServiceOp) GetShopMetafieldByKey added in v1.2.0

func (s *MetafieldServiceOp) GetShopMetafieldByKey(namespace, key string) (Metafield, error)

func (*MetafieldServiceOp) ListAllShopMetafields added in v1.2.0

func (s *MetafieldServiceOp) ListAllShopMetafields() ([]*Metafield, error)

func (*MetafieldServiceOp) ListShopMetafieldsByNamespace added in v1.2.0

func (s *MetafieldServiceOp) ListShopMetafieldsByNamespace(namespace string) ([]*Metafield, error)

type MetafieldValueType added in v1.0.0

type MetafieldValueType string

MetafieldValueType enum INTEGER An integer. JSON_STRING A JSON string. STRING A string.

type Money added in v1.0.0

type Money string // Serialized and truncated to 2 decimals decimal.Decimal

type MoneyBag added in v1.1.0

type MoneyBag struct {
	PresentmentMoney MoneyV2 `json:"presentmentMoney,omitempty"`
	ShopMoney        MoneyV2 `json:"shopMoney,omitempty"`
}

type MoneyV2 added in v1.1.0

type MoneyV2 struct {
	Amount       Decimal      `json:"amount,omitempty"`
	CurrencyCode CurrencyCode `json:"currencyCode,omitempty"`
}

type Order added in v1.1.0

type Order struct {
	ID               graphql.ID     `json:"id,omitempty"`
	LegacyResourceID graphql.String `json:"legacyResourceId,omitempty"`
	CreatedAt        DateTime       `json:"createdAt,omitempty"`
	Customer         Customer       `json:"customer,omitempty"`
	ClientIP         graphql.String `json:"clientIp,omitempty"`
	TaxLines         []TaxLine      `json:"taxLines,omitempty"`
	TotalReceivedSet MoneyBag       `json:"totalReceivedSet,omitempty"`
	LineItems        []LineItem     `json:"lineItems,omitempty"`
}

type OrderLineItemNode added in v1.1.0

type OrderLineItemNode struct {
	Node LineItem `json:"node,omitempty"`
}

type OrderService added in v1.1.0

type OrderService interface {
	List(query string) ([]*Order, error)
	ListAll() ([]*Order, error)
}

type OrderServiceOp added in v1.1.0

type OrderServiceOp struct {
	// contains filtered or unexported fields
}

func (*OrderServiceOp) List added in v1.1.0

func (s *OrderServiceOp) List(query string) ([]*Order, error)

func (*OrderServiceOp) ListAll added in v1.1.0

func (s *OrderServiceOp) ListAll() ([]*Order, error)

type Product added in v1.0.0

type Product struct {
	ID               graphql.ID          `json:"id,omitempty"`
	LegacyResourceID graphql.String      `json:"legacyResourceId,omitempty"`
	Handle           graphql.String      `json:"handle,omitempty"`
	Options          []ProductOption     `json:"options,omitempty"`
	Tags             []graphql.String    `json:"tags,omitempty"`
	Description      graphql.String      `json:"description,omitempty"`
	Title            graphql.String      `json:"title,omitempty"`
	PriceRangeV2     ProductPriceRangeV2 `json:"priceRangeV2,omitempty"`
	ProductType      graphql.String      `json:"productType,omitempty"`
	Vendor           graphql.String      `json:"vendor,omitempty"`
	TotalInventory   graphql.Int         `json:"totalInventory,omitempty"`
	OnlineStoreURL   graphql.String      `json:"onlineStoreUrl,omitempty"`
	DescriptionHTML  graphql.String      `json:"descriptionHtml,omitempty"`
	SEO              *SEOInput           `json:"seo,omitempty"`
	TemplateSuffix   graphql.String      `json:"templateSuffix,omitempty"`

	Metafields      []Metafield      `json:"metafields,omitempty"`
	ProductVariants []ProductVariant `json:"variants,omitempty"`
}

type ProductCreate added in v1.0.0

type ProductCreate struct {
	ProductInput ProductInput
	MediaInput   []CreateMediaInput
}

type ProductDelete added in v1.0.0

type ProductDelete struct {
	ProductInput ProductDeleteInput
}

type ProductDeleteInput added in v1.0.0

type ProductDeleteInput struct {
	ID graphql.ID `json:"id,omitempty"`
}

type ProductInput added in v1.0.0

type ProductInput struct {
	// The IDs of the collections that this product will be added to.
	CollectionsToJoin []graphql.ID `json:"collectionsToJoin,omitempty"`

	// The IDs of collections that will no longer include the product.
	CollectionsToLeave []graphql.ID `json:"collectionsToLeave,omitempty"`

	// The description of the product, complete with HTML formatting.
	DescriptionHTML graphql.String `json:"descriptionHtml,omitempty"`

	// Whether the product is a gift card.
	GiftCard graphql.Boolean `json:"giftCard,omitempty"`

	// The theme template used when viewing the gift card in a store.
	GiftCardTemplateSuffix graphql.String `json:"giftCardTemplateSuffix,omitempty"`

	// A unique human-friendly string for the product. Automatically generated from the product's title.
	Handle graphql.String `json:"handle,omitempty"`

	// Specifies the product to update in productUpdate or creates a new product if absent in productCreate.
	ID graphql.ID `json:"id,omitempty"`

	// The images to associate with the product.
	Images []ImageInput `json:"images,omitempty"`

	// The metafields to associate with this product.
	Metafields []MetafieldInput `json:"metafields,omitempty"`

	// List of custom product options (maximum of 3 per product).
	Options []graphql.String `json:"options,omitempty"`

	// The product type specified by the merchant.
	ProductType graphql.String `json:"productType,omitempty"`

	// Whether a redirect is required after a new handle has been provided. If true, then the old handle is redirected to the new one automatically.
	RedirectNewHandle graphql.Boolean `json:"redirectNewHandle,omitempty"`

	// The SEO information associated with the product.
	SEO *SEOInput `json:"seo,omitempty"`

	// A comma separated list tags that have been added to the product.
	Tags []graphql.String `json:"tags,omitempty"`

	// The theme template used when viewing the product in a store.
	TemplateSuffix graphql.String `json:"templateSuffix,omitempty"`

	// The title of the product.
	Title graphql.String `json:"title,omitempty"`

	// A list of variants associated with the product.
	Variants []ProductVariantInput `json:"variants,omitempty"`

	// The name of the product's vendor.
	Vendor graphql.String `json:"vendor,omitempty"`
}

type ProductOption added in v1.0.1

type ProductOption struct {
	Name   graphql.String   `json:"name,omitempty"`
	Values []graphql.String `json:"values,omitempty"`
}

type ProductPriceRangeV2 added in v1.1.0

type ProductPriceRangeV2 struct {
	MinVariantPrice MoneyV2 `json:"minVariantPrice,omitempty"`
	MaxVariantPrice MoneyV2 `json:"maxVariantPrice,omitempty"`
}

type ProductService added in v1.0.0

type ProductService interface {
	List(query string) ([]*Product, error)
	ListAll() ([]*Product, error)

	Get(gid graphql.ID) (*Product, error)

	Create(product *ProductCreate) error
	CreateBulk(products []*ProductCreate) error

	Update(product *ProductUpdate) error
	UpdateBulk(products []*ProductUpdate) error

	Delete(product *ProductDelete) error
	DeleteBulk(products []*ProductDelete) error
}

type ProductServiceOp added in v1.0.0

type ProductServiceOp struct {
	// contains filtered or unexported fields
}

func (*ProductServiceOp) Create added in v1.0.0

func (s *ProductServiceOp) Create(product *ProductCreate) error

func (*ProductServiceOp) CreateBulk added in v1.0.0

func (s *ProductServiceOp) CreateBulk(products []*ProductCreate) error

func (*ProductServiceOp) Delete added in v1.0.0

func (s *ProductServiceOp) Delete(product *ProductDelete) error

func (*ProductServiceOp) DeleteBulk added in v1.0.0

func (s *ProductServiceOp) DeleteBulk(products []*ProductDelete) error

func (*ProductServiceOp) Get added in v1.0.1

func (s *ProductServiceOp) Get(id graphql.ID) (*Product, error)

func (*ProductServiceOp) List added in v1.0.1

func (s *ProductServiceOp) List(query string) ([]*Product, error)

func (*ProductServiceOp) ListAll added in v1.0.0

func (s *ProductServiceOp) ListAll() ([]*Product, error)

func (*ProductServiceOp) Update added in v1.0.0

func (s *ProductServiceOp) Update(product *ProductUpdate) error

func (*ProductServiceOp) UpdateBulk added in v1.0.0

func (s *ProductServiceOp) UpdateBulk(products []*ProductUpdate) error

type ProductShort added in v1.0.1

type ProductShort struct {
	ID     graphql.ID       `json:"id,omitempty"`
	Handle graphql.String   `json:"handle,omitempty"`
	Tags   []graphql.String `json:"tags,omitempty"`
}

type ProductShortNode added in v1.0.1

type ProductShortNode struct {
	Node ProductShort `json:"node,omitempty"`
}

type ProductUpdate added in v1.0.0

type ProductUpdate struct {
	ProductInput ProductInput
}

type ProductVariant added in v1.0.1

type ProductVariant struct {
	ID                graphql.ID       `json:"id,omitempty"`
	LegacyResourceID  graphql.String   `json:"legacyResourceId,omitempty"`
	SKU               graphql.String   `json:"sku,omitempty"`
	SelectedOptions   []SelectedOption `json:"selectedOptions,omitempty"`
	CompareAtPrice    Money            `json:"compareAtPrice,omitempty"`
	Price             Money            `json:"price,omitempty"`
	InventoryQuantity graphql.Int      `json:"inventoryQuantity,omitempty"`
	InventoryItem     InventoryItem    `json:"inventoryItem,omitempty"`
}

type ProductVariantInput added in v1.0.0

type ProductVariantInput struct {
	// The value of the barcode associated with the product.
	Barcode graphql.String `json:"barcode,omitempty"`

	// The compare-at price of the variant.
	CompareAtPrice *Money `json:"compareAtPrice"`

	// The ID of the fulfillment service associated with the variant.
	FulfillmentServiceID graphql.ID `json:"fulfillmentServiceId,omitempty"`

	// The Harmonized System Code (or HS Tariff Code) for the variant.
	HarmonizedSystemCode graphql.String `json:"harmonizedSystemCode,omitempty"`

	// Specifies the product variant to update or create a new variant if absent.
	ID graphql.ID `json:"id,omitempty"`

	// The ID of the image that's associated with the variant.
	ImageID graphql.ID `json:"imageId,omitempty"`

	// The URL of an image to associate with the variant. This field can only be used through mutations that create product images and must match one of the URLs being created on the product.
	ImageSrc graphql.String `json:"imageSrc,omitempty"`

	// Inventory Item associated with the variant, used for unit cost.
	InventoryItem *InventoryItemInput `json:"inventoryItem,omitempty"`

	// Whether customers are allowed to place an order for the product variant when it's out of stock.
	InventoryPolicy ProductVariantInventoryPolicy `json:"inventoryPolicy,omitempty"`

	// Create only field. The inventory quantities at each location where the variant is stocked.
	InventoryQuantities []InventoryLevelInput `json:"inventoryQuantities,omitempty"`

	// The ID of the corresponding resource in the REST Admin API.
	LegacyResourceID graphql.String `json:"legacyResourceId,omitempty"`

	// Additional customizable information about the product variant.
	Metafields []MetafieldInput `json:"metafields,omitempty"`

	// The custom properties that a shop owner uses to define product variants.
	Options []graphql.String `json:"options,omitempty"`

	// The order of the product variant in the list of product variants. The first position in the list is 1.
	Position graphql.Int `json:"position,omitempty"`

	// The price of the variant.
	Price Money `json:"price,omitempty"`

	// Create only required field. Specifies the product on which to create the variant.
	ProductID graphql.ID `json:"productId,omitempty"`

	// Whether the variant requires shipping.
	RequiresShipping graphql.Boolean `json:"requiresShipping,omitempty"`

	// The SKU for the variant.
	SKU graphql.String `json:"sku,omitempty"`

	// This parameter applies only to the stores that have the Avalara AvaTax app installed. Specifies the Avalara tax code for the product variant.
	TaxCode graphql.String `json:"taxCode,omitempty"`

	// Whether the variant is taxable.
	Taxable graphql.Boolean `json:"taxable,omitempty"`

	// This argument is deprecated: Variant title is not a writable field; it is generated from the selected variant options.
	Title graphql.String `json:"title,omitempty"`

	// The weight of the variant.
	Weight graphql.Float `json:"weight,omitempty"`

	// The unit of weight that's used to measure the variant.
	WeightUnit WeightUnit `json:"weightUnit,omitempty"`
}

type ProductVariantInventoryPolicy added in v1.0.0

type ProductVariantInventoryPolicy string

ProductVariantInventoryPolicy String enum: CONTINUE, DENY

type ProductVariantPricePair added in v1.1.0

type ProductVariantPricePair struct {
	CompareAtPrice Money `json:"compareAtPrice,omitempty"`
	Price          Money `json:"price,omitempty"`
}

type ProductVariantUpdate added in v1.0.1

type ProductVariantUpdate struct {
	ProductVariantInput ProductVariantInput
}

type SEOInput added in v1.0.0

type SEOInput struct {
	Description graphql.String `json:"description,omitempty"`
	Title       graphql.String `json:"title,omitempty"`
}

type SelectedOption added in v1.0.1

type SelectedOption struct {
	Name  graphql.String `json:"name,omitempty"`
	Value graphql.String `json:"value,omitempty"`
}

type TaxLine added in v1.1.0

type TaxLine struct {
	PriceSet       MoneyBag       `json:"priceSet,omitempty"`
	Rate           graphql.Float  `json:"rate,omitempty"`
	RatePercentage graphql.Float  `json:"ratePercentage,omitempty"`
	Title          graphql.String `json:"title,omitempty"`
}

type UserErrors added in v1.0.0

type UserErrors struct {
	Field   []graphql.String
	Message graphql.String
}

type VariantService added in v1.0.1

type VariantService interface {
	Update(variant *ProductVariantUpdate) error
}

type VariantServiceOp added in v1.0.1

type VariantServiceOp struct {
	// contains filtered or unexported fields
}

func (*VariantServiceOp) Update added in v1.0.1

func (s *VariantServiceOp) Update(variant *ProductVariantUpdate) error

type WeightUnit added in v1.0.0

type WeightUnit string

WeightUnit String enum: GRAMS, KILOGRAMS, OUNCES, POUNDS

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL