Skip to main content
shoppy.articles.get(idOrHandle, blogHandle?)
Fetches a single article by handle or Shopify GID.

Parameters

ParamTypeRequiredDescription
idOrHandlestringYesArticle handle or Shopify GID
blogHandlestringNoBlog handle (required when fetching by article handle)
When fetching by handle, you must either use .blog() or pass the blogHandle parameter.

Returns

ShopifyArticle | null

Examples

Get by handle

const article = await shoppy.articles.get('my-first-post', 'news')

if (article) {
    console.log(article.title)
}

Get by handle with .blog()

const article = await shoppy.articles
    .blog('news')
    .get('my-first-post')

Get by Shopify GID

const article = await shoppy.articles.get(
    'gid://shopify/Article/123456789'
)

With field selection

const article = await shoppy.articles
    .select(['title', 'handle', 'content', 'image', 'author'])
    .get('gid://shopify/Article/123456789')

Handle not found

const article = await shoppy.articles.get('non-existent', 'news')

if (!article) {
    console.log('Article not found')
}