ID of the metafield to update.
ID of Product owning the metafield to update.
Value that will be set to the metafield being updated.
Type of the metafield value, can be string or integer.
async
(params, auths) => {
}
try
{
var product = await require("@pipedreamhq/platform").axios(this, {
method: "GET",
url: `https://${auths.shopify.shop_id}.myshopify.com/admin/api/2019-10/metafields/${params.metafield_id}.json`,
headers: {
"X-Shopify-Access-Token": `${auths.shopify.oauth_access_token}`
}
});
if(product){
this.resp = await require("@pipedreamhq/platform").axios(this, {
method: "POST",
url: `https://${auths.shopify.shop_id}.myshopify.com/admin/products/${params.product_id}/metafields.json`,
headers: {
"X-Shopify-Access-Token": `${auths.shopify.oauth_access_token}`
},
data:{
metafield: {
id: params.metafield_id,
value: params.value,
value_type: params.value_type
}
}
});
}
}catch(err){
this.err = err;
}