In my application build in PHP I have converter from JSON to object. But in logs I can see errors like:
Uncaught PHP Exception TypeError: "App\CarrierService\CarrierServiceAddress::__construct(): Argument #6 ($address1) must be of type ?string, array given, called
In my logs I can see JSON:
{
"rate":{
"origin":{
"country":"GB",
"postal_code":null,
"province":null,
"city":null,
"name":"Shop location",
"address1":{
"first_name":null,
"address1":null,
"phone":null,
"city":null,
"zip":null,
"province":null,
"country":"United Kingdom",
"last_name":null,
"address2":null,
"company":null,
"latitude":null,
"longitude":null,
"name":"",
"country_code":"GB",
"province_code":null
},
"address2":null,
"address3":null,
"latitude":null,
"longitude":null,
"phone":null,
"fax":null,
"email":null,
"address_type":null,
"company_name":"myteststore-wp"
},
"destination":{
"country":"DK",
"postal_code":"8660",
"province":null,
"city":"rate test",
"name":null,
"address1":"rate test",
"address2":null,
"address3":null,
"latitude":null,
"longitude":null,
"phone":null,
"fax":null,
"email":null,
"address_type":null,
"company_name":null
},
"items":[
{
"name":"",
"sku":"XXXXXXXX",
"quantity":1,
"grams":100,
"price":0,
"vendor":null,
"requires_shipping":true,
"taxable":true,
"fulfillment_service":"manual",
"properties":null,
"product_id":null,
"variant_id":null
}
],
"currency":"GBP",
"locale":"en"
}
}
In docs I can see example for Shopify Request and I can see, that address is a string, not array. It looks like issue in Shopify API or docs. Why for example product_id is empty?
"name":"Bob Norman",
"address1":"24 Sussex Dr.",
"address2":"",
"address3":null,
"phone":null,
"fax":null,
"email":null,
"address_type":null,
"company_name":null
},
"items":[
{
"name":"Short Sleeve T-Shirt",
"sku":"",
"quantity":1,
"grams":1000,
"price":1999,
"vendor":"Jamie D's Emporium",
"requires_shipping":true,
"taxable":true,
"fulfillment_service":"manual",
"properties":null,
"product_id":48447225880,
"variant_id":258644705304
}
],
"currency":"USD",
"locale":"en"
}
}