I am trying to edit a product's option values in Shopify. Essentially, I want to pass a reordered array for products[0].options[0].values
Using Shopify's REST API docs, I make a request like so:
import {Product} from '@shopify/shopify-api/dist/rest-resources/2021-10/index.js';
const test_session = await Shopify.Utils.loadCurrentSession(request, response);
const product = new Product({session: test_session});
product.id = 7758005469437;
product.options[0].values = newOptionsOrder;
await product.save({});
I get the following error:
Cannot read properties of undefined (reading '0')
I was successfuly able to edit the title of the target product using product.title = "New Title"; The issue just seems to be targeting more nested elements.
Any idea how to edit the first options.values array?