error on updating delivery profile with graphql api

Antonio84
Shopify Partner
43 1 2

Hello I am getting error when I try to associate a variant to a delivery profile, I am using python, this is the code:

query = """
            mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) 
                {  
                    deliveryProfileUpdate(id: $id, profile: $profile) 
                    {    
                        profile {      
                            id    
                        }    
                        userErrors {      
                            field      
                            message    
                        }
                    }
                }  
            """
        variables = {
            "id":"gid://shopify/DeliveryProfile/DID",
            "profile":{
                "variantsToAssociate":"gid://shopify/ProductVariant/VID"
            }
        }
        result = shopify.GraphQL().execute(query, variables=variables)

This is the error message:

[{'field': None, 'message': 'Profile could not be updated.'}]
Reply 1 (1)
JamesG
Shopify Staff
Shopify Staff
42 10 9

Hey @Antonio84 

 

I'm able to add and remove variants to my test stores' delivery profiles using the deliveryProfileUpdate mutation and the Shopify Python API library.

 

Have you tried making the same request in an HTTP client like Postman or Insomnia? Can you update other delivery profiles on your store?

 

We can't provide authenticated support in the forums, but if there's something specific about one of the deliveryProfiles on your store that cannot be updated I'd recommend reaching out to our support directly with an example.  

 

Cheers

JamesG | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog