I want to return the name of a publication, this field says it’s deprecated but it returns the right value. Field also says to use Catalog.title instead, doing so I get “catalog”:null. I’m confused, is the documentation incorrect? Am I doing something wrong?
query publications {
publications(first: 3) {
edges {
node {
id
autoPublish
name
catalog {
id
status
title
}
}
}
}
}
publications documentation
1 Like
Hi @pinghajen,
I can confirm that this is expected that the publication.name field is deprecated and the expected way to get the name is from the catalog.title field.
I’m also able to replicate the behaviour you’re experiencing, with publications created via the publicationCreate mutation, not passing the input.catalogId input argument, being created without any associated catalogs.
This leads to the publication.catalog returning null.
I’ve discussed this behaviour our developers further who has confirmed this is expected behaviour at this time.
Even though publications without any associated catalogs don’t actually do anything, this was done by design to allow apps to create publications in advance, then associate a catalog with them at a later time with the catalogUpdate mutation (passing in the publication id in the input). This allows for apps to “stage data” in advance before associating the publications and catalogs together.
If you are creating the publiciations yourself and if you want them to be named, you should associate an existing catalog with them during the publicationCreate mutation.
Otherwise, you can basically ignore publications without any catalogs, as they don’t actually do anything until they do have a catalog associated with them.
I’ll be submitting some feedback on your behalf to our developers internally, as this is a confusing workflow, especially when a publication needs a catalog associated with it to actually do anything on the storefront, I’ll be recommending that the publicationCreate mutation should have the input.catalogId as a required input field, and the mutation should fail if a valid catalog is not included.
For more information on how Catalogs and Publications work, you can refer to our Shopify.dev documentation: