Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gowizzard committed Sep 27, 2021
1 parent 0cf04dd commit 8222402
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,51 @@ if err != nil {
}
```

## Create a variant to a product

If you want to create a new variant, you can do so using the following function. The ID of the main product is required.

You can find the description from Shopify [here](https://shopify.dev/api/admin-rest/2021-07/resources/product-variant#[post]/admin/api/2021-07/products/{product_id}/variants.json).

```go
// Define request
r := goshopify.Request{
ApiKey: "",
ApiPassword: "",
StoreName: "",
}

// Define body
body := ProductVariantBody{
ProductVariantBodyVariant{
Title: "Testartikel",
Price: "24,99",
Sku: "21481462121",
CompareAtPrice: "48,99",
FulfillmentService: "manual",
InventoryManagement: "shopify",
Option1: "42",
Option2: "",
Option3: "",
Taxable: true,
Barcode: "",
Grams: 0,
Weight: 0,
WeightUnit: "",
InventoryQuantity: 0,
RequiresShipping: true,
},
}

// Create a product variant
variant, err := goshopify.AddProductVariant(6917353078968, body, r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(variant)
}
```

## Get list of orders since id

To get a list of orders, you can call the following function. The list shows all orders by a certain ID, if you leave this ID at 0, then the orders are displayed from the beginning. 200 orders are always read out at once.
Expand Down

0 comments on commit 8222402

Please sign in to comment.