slince / shopify-api-php

:rocket: Shopify API Client for PHP
MIT License
128 stars 47 forks source link

Still can't update total_Tax #50

Closed tone10 closed 4 years ago

tone10 commented 4 years ago

I am leveraging the proper method and have been able to change a note, but not total tax. It is not part of the tax_lines it is a stand alone field, but it is still not updating. Any thoughts?

$id="1883012333647";

$order = $client->getDraftOrderManager()->find(511255085135);

$data = $client->putOrderManager()->update($id, [ "total_tax" => "8.25" ]);

coreyee commented 4 years ago

Hello, if you encounter an error, please post the error message first, you post a piece of error code to me does not see anything.

https://github.com/slince/shopify-api-php/blob/master/src/Manager/DraftOrder/DraftOrderManagerInterface.php

According to the draft order manager interface declaration, you should use the following code

$order = $client->getDraftOrderManager()->update($id, [
    'total_tax' => '8.25'
]);

If it still doesn't work (please post any errors first), you can use basic curd.

$data = $client->put("draft_orders/{$id}",  ['draft_order' => [
     'total_tax' => '8.25'
]]);

If not, shopify does not support changing this parameter, and you can go to the shopify official community for help