Is there a way to use shopify-api-node to reference products?

58 views Asked by At

My Goal: Update meta on a Shopify product via the 'shopify-api-node' NP.

The Expected Result: A Shopify product with reference products added to it.

The Actual Result: 422 Error


What I've tried: countless methods, this is the latest:

shopify.metafield.create({
        namespace: 'custom',
        key: 'similar_products',
        value: JSON.stringify(productIDS),
        valueType: 'list.product_reference',
        ownerResource: 'product',
        ownerId: coreID,
    }, (err, data) => {
        if (err) {
            console.error(err);
        } else {
            console.log('Metafield created:', data);
        }
    });

The variables in my code: codeID (The main product ID that the meta will be appended to), productIDS (and array of product ids such as 144124 185127 etc).

0

There are 0 answers