API Script for Shopify
It is necessary to create a script (js method) that will update the number of products via API
- connecting node adminClientAPI (official package)
- updating through mutation GraphQL (or your option)
- updating by delta (+1, -2, etc.)
In fact, the function exists but gives an error that the Input has an incorrect format, other methods in the project work well
Ось весь код який має запрацювати.
const client = createAdminApiClient({
storeDomain: process.env.SF_DOMAIN,
apiVersion: process.env.SF_API_VERSION,
accessToken: process.env.SF_ADMIN_ACCESS_TOKEN,
});
const mutateInventoryQuantity = async (inventoryItemId, delta) => {
const mutation = `
mutation inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) {
inventoryAdjustQuantities(input: $input) {
userErrors {
field
message
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes {
name
delta
}
}
}
}
`;
const input = {
reason: "correction",
changes: [
{
delta,
inventoryItemId,
locationId: process.env.SF_CONST_LOCATION_ID
}
]
};
console.log('DEBUG: payload', JSON.stringify({ input }, null, 2));
try {
return await client.request(mutation, { input });
} catch (error) {
console.error('Failed to mutate inventory:', error);
throw error;
}
}
mutateInventoryQuantity(id, delta)
RESPONSE
Variable $input of type InventoryAdjustQuantitiesInput! was provided invalid value {
value: null,
problems: [ { path: [], explanation: 'Expected value to not be null' } ]
}
-
const mutateInventoryQuantity = async (inventoryItemId, delta) => {
const mutation = `
mutation inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) {
inventoryAdjustQuantities(input: $input) {
userErrors {
field
message
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes {
name
delta
}
}
}
}
`;
const input = {
reason: "correction",
changes: [
{
delta,
inventoryItemId,
locationId: process.env.SF_CONST_LOCATION_ID
}
]
};
console.log('DEBUG: payload', JSON.stringify({ input }, null, 2));
try {
return await client.request(mutation, { input });
} catch (error) {
console.error('Failed to mutate inventory:', error);
throw error;
}
}
RESPONSE
Variable $input of type InventoryAdjustQuantitiesInput! was provided invalid value {
value: null,
problems: [ { path: [], explanation: 'Expected value to not be null' } ]
}
ось така відповідь з сервера -
Current freelance projects in the category Javascript and Typescript
Development of a mobile application for podologyDevelopment of a cross-platform mobile application on React Native (iOS and Android) is required. The application is designed for podologist specialists. It allows maintaining a patient database, recording visits, attaching photos, managing staff and tariffs. The design is fully… Javascript and Typescript ∙ 1 hour 12 minutes back ∙ 9 proposals |
Technical SEO fixes for WP website
24 USD
It is necessary to implement the first technical task for WP optimization (headings, code validity, image size, speed...). Regarding the cost: I will send the technical task, you review it and specify the cost and deadlines. Thank you. Content Management Systems, Javascript and Typescript ∙ 7 hours 40 minutes back ∙ 9 proposals |
Integration of the front to the kebab backend tg
48 USD
Need a ReactJS developer to implement Ton Connect and complete the front end, integrate the backend into the front end, and do whatever is needed on the backend for Ton Connect front html css reactjs Back end fastapi python Terms: 1 day Javascript and Typescript, Web Programming ∙ 17 hours 6 minutes back ∙ 7 proposals |
Refactoring JS codeGood day, I have 3 files, one with 800 lines, one with 300, and one with about 600. I need to do refactoring because DOM Loading is called multiple times, and as I understand it, this is not working quite correctly. Ideally, split the one with 800 lines into 2 files, and create… Javascript and Typescript ∙ 1 day 3 hours back ∙ 14 proposals |
Analysis of text files and output of results in a Telegram bot
48 USD
The project executor has stopped responding, and I need to make edits and improve the task. Technology stack: Backend: Node.js, Typescript Database: Postgres, Redis Queue: BullMQ All set up in Docker containers for easy deployment on the server Server: Hetzner I need someone… Javascript and Typescript, Data Parsing ∙ 1 day 3 hours back ∙ 6 proposals |