fixes to create new products

This commit is contained in:
Ben Miller
2024-11-16 05:24:19 -07:00
parent 69ec8b8cdd
commit 531da95091
2 changed files with 7 additions and 3 deletions

View File

@ -128,7 +128,9 @@ export class Product {
let sps = new ShopifyProductSetInput()
//TODO: map category IDs
//sps.category = this.category
if (this.shopify_id != "") {
sps.id = this.shopify_id
}
if (this.shopify_status.match('DRAFT|ACTIVE|ARCHIVED')) {
sps.status = this.shopify_status
}
@ -139,7 +141,9 @@ export class Product {
sps.variants = []
let variant = new ShopifyVariant()
//TODO: handle multiple variants
if (this.shopify_default_variant_id != "") {
variant.id = this.shopify_default_variant_id
}
variant.sku = this.sku
variant.price = this.price
sps.variants.push(variant)

View File

@ -847,7 +847,7 @@ export class ShopifyProductSetQuery {
export class ShopifyProductSetInput {
category: string
descriptionHtml: string
id: string
id?: string
productType: string
redirectNewHandle: boolean = true
status: string = "DRAFT"