adding some type changes
This commit is contained in:
@ -128,6 +128,28 @@ export class Product {
|
||||
sps.tags = this.tags
|
||||
sps.title = this.title
|
||||
sps.descriptionHtml = this.description
|
||||
sps.metafields = []
|
||||
if (this.product_height_cm > 0) {
|
||||
sps.metafields.push({
|
||||
key: "product_height_cm",
|
||||
namespace: "custom",
|
||||
value: this.product_height_cm.toString(),
|
||||
})
|
||||
}
|
||||
if (this.product_width_cm > 0) {
|
||||
sps.metafields.push({
|
||||
key: "product_width_cm",
|
||||
namespace: "custom",
|
||||
value: this.product_width_cm.toString(),
|
||||
})
|
||||
}
|
||||
if (this.product_depth_cm > 0) {
|
||||
sps.metafields.push({
|
||||
key: "product_depth_cm",
|
||||
namespace: "custom",
|
||||
value: this.product_width_cm.toString(),
|
||||
})
|
||||
}
|
||||
sps.variants = []
|
||||
let variant = new ShopifyVariant()
|
||||
//TODO: handle multiple variants
|
||||
@ -139,12 +161,9 @@ export class Product {
|
||||
if (this.compare_at_price > 0) {
|
||||
variant.compareAtPrice = this.compare_at_price
|
||||
}
|
||||
variant.nodes = []
|
||||
let variantWeight = new ShopifyProductVariant()
|
||||
if (this.weight_grams > 0) {
|
||||
variantWeight.weight = this.weight_grams
|
||||
variantWeight.weight_unit = "GRAMS"
|
||||
variant.nodes.push(variantWeight)
|
||||
variant.inventory_item.measurement.weight.value = this.weight_grams
|
||||
variant.inventory_item.measurement.weight.unit = shopify.WeightUnit.GRAMS
|
||||
}
|
||||
sps.variants.push(variant)
|
||||
console.log("ToShopifyProductSet:\n" + JSON.stringify(sps, null, 2))
|
||||
|
||||
@ -890,6 +890,8 @@ export class ShopifyVariant {
|
||||
compareAtPrice?: number
|
||||
barcode?: string
|
||||
position?: number
|
||||
metafields?: shopify.Metafield[]
|
||||
inventory_item?: shopify.InventoryItemInput
|
||||
nodes?: ShopifyProductVariant[]
|
||||
//TODO: support multiple options
|
||||
optionValues: [{}] = [
|
||||
@ -1016,6 +1018,7 @@ export class ShopifyProductSetInput {
|
||||
title: string
|
||||
vendor: string
|
||||
variants: ShopifyVariant[]
|
||||
metafields: shopify.MetafieldInput[]
|
||||
//TODO: Support multiple product options
|
||||
productOptions: [{}] = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user