Accepting credit cards, warehouses, and shipping and fulfilling orders
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I am currently trying to add carrier service to the list of carriers, as I want to use third party carrier calculated shipping rates. I am using Shopify plan (billed annualy) and my develop app has `write_shipping` and `read_shipping` enabled.
The code which I execute is below:
const axios = require('axios'); const shopName = '[my_shop_name]'; const accessToken = '[my_access_token]'; const carrierServiceData = { "carrier_service": { "name": "[name]", "callback_url": "[callback_url]", "service_discovery": true } }; async function createCarrierService() { try { const response = await axios.post(`https://${shopName}.myshopify.com/admin/api/2024-01/carrier_services.json`, carrierServiceData, { headers: { 'X-Shopify-Access-Token': accessToken, 'Content-Type': 'application/json', }, }); console.log('Carrier Service Created:', response.data); } catch (error) { console.error('Error creating carrier service:', error); } } createCarrierService();
Now, the response returns status 200, however, response.data returns and empty array, which means the carrier service never gets actually created and placed inside of carrier_services.json file. I have double checked all the parameters.
I managed to work around the issue by substituting the domain with the default one assigned to the store. (df4b5a-a7.myshopify.com)
https://df4b5a-a7.myshopify.com/admin/api/2024-01/carrier_services.json