{"id":16970687,"date":"2023-08-14T09:51:24","date_gmt":"2023-08-14T09:51:24","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/fetchrates\/"},"modified":"2023-08-14T09:51:24","modified_gmt":"2023-08-14T09:51:24","slug":"fetchrates","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/fetchrates\/","title":{"rendered":"fetchRates"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code><strong>I have two requests<\/strong>\n<strong>1.<\/strong>\n'{\"from\":{\"company\":\"Test Supplies\",\"address1\":\"Test street \",\"city\":\"Test city\",\"state\":\"ON\",\"country\":\"CA\",\"zip\":\"XXXXXX\"},\"to\":{\"company\":null,\"address1\":\"1437 C\\u00f4te Joyeuse\",\"city\":\"St Apollinaire\",\"state\":\"QC\",\"country\":\"CA\",\"zip\":\"XXXXX\"},\"currency\":\"CAD\",\"unit\":\"METRIC\",\"expectedShipDate\":\"XXXXXX\",\"packageType\":\"PACKAGE\",\"storeIdentifier\":\"example.info\",\"packages\":&#091;{\"shopifyProductId\":8591,\"shopifyVariantId\":0,\"weight\":0,\"quantity\":1},{\"shopifyProductId\":8561,\"shopifyVariantId\":0,\"weight\":0,\"quantity\":49}]}'\n\n<strong>2.<\/strong>\n'{\"from\":{\"company\":\"Test Supplies\",\"address1\":\"Test street \",\"city\":\"Test city\",\"state\":\"ON\",\"country\":\"CA\",\"zip\":\"XXXXXX\"},\"to\":{\"company\":null,\"address1\":\"1437 C\\u00f4te Joyeuse\",\"city\":\"St Apollinaire\",\"state\":\"QC\",\"country\":\"CA\",\"zip\":\"XXXXX\"},\"currency\":\"CAD\",\"unit\":\"METRIC\",\"expectedShipDate\":\"XXXXXX\",\"packageType\":\"PACKAGE\",\"storeIdentifier\":\"example.info\",\"packages\":&#091;{\"shopifyProductId\":8591,\"shopifyVariantId\":0,\"weight\":0,\"quantity\":1},{\"shopifyProductId\":8561,\"shopifyVariantId\":0,\"weight\":0,\"quantity\":50}]}'\n\n<strong>the only difference between them is the quantity of the product.\n\nAt the first request it returns rates, but at the second nothing<\/strong>\n\n<strong>1. <\/strong>\n\narray (\n'response' =&gt;\n(object) array(\n'data' =&gt;\n(object) array(\n'rates' =&gt;\narray (\n0 =&gt;\n(object) array(\n'serviceName' =&gt; 'Standard',\n'carrierName' =&gt; 'UPS',\n'serviceCode' =&gt; '604',\n'totalCharge' =&gt; 85.43,\n'estTransitDays' =&gt; '2',\n'description' =&gt; 'Rate details',\n'currency' =&gt; 'CAD',\n),\n1 =&gt;\n(object) array(\n'serviceName' =&gt; 'Ground',\n'carrierName' =&gt; 'Canpar',\n'serviceCode' =&gt; '4500',\n'totalCharge' =&gt; 184.31,\n'estTransitDays' =&gt; '1',\n'description' =&gt; 'Rate details',\n'currency' =&gt; 'CAD',\n),\n2 =&gt;\n(object) array(\n'serviceName' =&gt; 'Expedited',\n'carrierName' =&gt; 'UPS',\n'serviceCode' =&gt; '601',\n'totalCharge' =&gt; 1018.01,\n'estTransitDays' =&gt; '2',\n'description' =&gt; 'Rate details',\n'currency' =&gt; 'CAD',\n),\n3 =&gt;\n(object) array(\n'serviceName' =&gt; 'UPS Saver',\n'carrierName' =&gt; 'UPS',\n'serviceCode' =&gt; '607',\n'totalCharge' =&gt; 1203.01,\n'estTransitDays' =&gt; '2',\n'description' =&gt; 'Rate details',\n'currency' =&gt; 'CAD',\n),\n4 =&gt;\n(object) array(\n'serviceName' =&gt; 'Express',\n'carrierName' =&gt; 'UPS',\n'serviceCode' =&gt; '600',\n'totalCharge' =&gt; 1585.15,\n'estTransitDays' =&gt; '2',\n'description' =&gt; 'Rate details',\n'currency' =&gt; 'CAD',\n),\n),\n),\n'message' =&gt; 'Rates fetched successfully',\n'success' =&gt; true,\n),\n'httpResponseCode' =&gt; 200,\n)\n\n<strong>2.<\/strong>\n\narray (\n  'response' =&gt; \n  (object) array(\n     'data' =&gt; \n    (object) array(\n       'rates' =&gt; \n      array (\n      ),\n    ),\n     'message' =&gt; 'Rates fetched successfully',\n     'success' =&gt; true,\n  ),\n  'httpResponseCode' =&gt; 200,\n)\n\n<strong>what could be the matter?<\/strong><\/code><\/pre>\n","protected":false},"template":"","class_list":["post-16970687","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16970687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16970687\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16970687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}