Skip to content

Commit 54bc2c8

Browse files
authored
Update set_zone_locations to return code (#11)
According to https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#update-a-locations-of-a-shipping-zone, and debugging, the response from the PUT on the /locations endpoint will return a JSON string containing a "code" and a "type" property. ID does not exist, and this will break unit tests on PHP8+
1 parent 27e94f1 commit 54bc2c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Factories/ShippingZone.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function get_object_by_id( $object_id ) {
6666
* Sets shipping zone locations.
6767
* @param int $object_id
6868
* @param array $data See https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#update-a-locations-of-a-shipping-zone
69-
* @return int
69+
* @return string
7070
* @throws Exception
7171
*/
7272
public function set_zone_locations( $object_id, $data ) {
@@ -75,6 +75,6 @@ public function set_zone_locations( $object_id, $data ) {
7575
$request->set_body( json_encode( $data ) ); //phpcs:ignore
7676

7777
$response = $this->do_request( $request );
78-
return $response->get_data()['id'];
78+
return $response->get_data()['code'];
7979
}
8080
}

0 commit comments

Comments
 (0)