Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only able to create single order #645

Open
peteroleeman opened this issue Jan 12, 2024 · 1 comment
Open

only able to create single order #645

peteroleeman opened this issue Jan 12, 2024 · 1 comment

Comments

@peteroleeman
Copy link

need help, trying to create order with code below. However i'm only able to create a single order. I have tried to call the function many times and for past 3 days, but it always return back the same order i created few days ago.

shopify.order.create(
{
//"user_id" : "gkash user id",
"order_id": 51,
//"api_version" : "2024-01",
// "id": 550789470,
"created_at": "2024-01-11T12:40:09+08:00",
"name": "A0051",
"number": 51,
"order_number": 51,
"kind": "sale",
"status": "success",
// "amount": 238.47,
"reference" : "gkash",
"source_name" : "gkash_source",
"processing_method" : "gkash_method",
//"device_id" : "gkash_terminal_id",
//"gateway" : "gkash_gateway",
"note" : "this is a detail note from gkash",
"tags": "Léon, Noël",
//"name" : "A001",
"note_attributes": [
{
"name": "custom engraving",
"value": "Happy Birthday"
},
{
"name": "colour",
"value": "green"
}
],

    "line_items" : [
        {
        "title" : "Big Brown Bear Boots",
        "price" : 74.99,
        //"grams" : "1300",
        "quantity": 1,
        // "tax_lines": [
        // {
        //     "price": 13.5,
        //     "rate": 0.06,
        //     "title": "State tax"
        // }
        // ]
    }
    ]
}

)
.then((order) => {

res.send(order)

})
.catch((err) => {
res.send(err)
});

@Kakha01
Copy link

Kakha01 commented Apr 24, 2024

@peteroleeman As mentioned in the shopify order resource,
parameters such as "created_at", "name", "order_number", etc. are read-only, which means that you cannot pass them as params, instead only shopify can modify those values.

shopify.order.create({
        "number": 51,
        "transactions": [{
            "kind": "sale",
            "status": "success",
            "amount": 238.47
        }],
        "source_name": "gkash_source",
        "note": "this is a detail note from gkash",
        "tags": "Léon,Noël",
        "note_attributes": [{
                "name": "custom engraving",
                "value": "Happy Birthday"
            },
            {
                "name": "colour",
                "value": "green"
            }
        ],
        "line_items": [{
            "title": "Big Brown Bear Boots",
            "price": 74.99,
            "quantity": 1,
        }]
    })
    .then((order) => {
        res.send(order)
    })
    .catch((err) => {
        res.send(err)
    });

your code should look something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants