Tento Product Update
Tento represents Shopify Update Product mutation
const result = await client . products .update ( "gid://shopify/Product/1" , {
fields : {
title : "Product #1" ,
} ,
});
// result type
const result : {
title : string ;
}
If you want to add existed Metafield Definition to Product , you can provide a metafields
object
and TypeScript will help you with metafields you can add:
const result = await client . products .update ( "gid://shopify/Product/1" , {
fields : {
metafields : {
// description is the name of metafield
description : "Innovative Product #1"
}
} ,
});
// return type
const result : {
metafields : {
key : string ;
type : MetafieldFieldType ;
namespace : string ;
ownerType : MetafieldOwnerType ;
id : string ;
value : string ;
}[];
}
import { metafield } from "@drizzle-team/tento" ;
export const descriptionMetafield = metafield ({
name : "description" , // this name will be used as key for metafield
key : "description" ,
namespace : "custom" ,
ownerType : "PRODUCT" ,
fieldDefinition : (f) => f .multiLineTextField () ,
});