Skip to main content
openbridge.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 openbridge.articles.get('my-first-post', 'news')

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

Get by handle with .blog()

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

Get by Shopify GID

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

With field selection

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

Handle not found

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

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