Accepting credit cards, warehouses, and shipping and fulfilling orders
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
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025