I already have built a custom app using the latest Node template (https://github.com/Shopify/shopify-app-template-node).
I can manage the product via product API with this code:
app.get("/api/products/count", async (_req, res) => {
const countData = await shopify.api.rest.Product.count({
session: res.locals.shopify.session,
});
res.status(200).send(countData);
});
But the fulfillment API is not working as expected; I need to make this work, My code is below:
app.post("/api/fulfillment", async (_req, res) => {
const fulfillment = await shopify.api.rest.Fulfillment({
session: res.locals.shopify.session,
});
fulfillment.line_items_by_fulfillment_order = [
{
fulfillment_order_id: _req?.data?.f_order?.id,
},
];
fulfillment.tracking_info = {
number: _req?.data?.f_order?.t_number,
url: _req?.data?.f_order?.t_url,
};
await fulfillment.save({
update: true,
});
res.json("response");
res.status(200).end();
});
It is giving ‘fulfillment.save’ is not a function error.
Thanks in advance ![]()