Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.shopi.lk/llms.txt

Use this file to discover all available pages before exploring further.

shop.getThemeSettings()

Returns the currently published theme settings for the shop. Use this to apply the shop owner’s customizations — colors, fonts, section visibility, and layout preferences — dynamically at runtime.
const theme = await shop.getThemeSettings();

Response

{
  theme_id: number;
  settings: Record<string, any>; // flexible — shape depends on theme
  is_published: boolean;
} | null
Returns null if no theme is published yet.

Example — Apply CSS variables

const theme = await shop.getThemeSettings();

if (theme?.settings) {
  const root = document.documentElement;
  const s = theme.settings;

  if (s.primary_color) root.style.setProperty('--color-primary', s.primary_color);
  if (s.font_family)   root.style.setProperty('--font-body', s.font_family);
  if (s.border_radius) root.style.setProperty('--radius', s.border_radius);
}

Example — Section visibility

const theme = await shop.getThemeSettings();

const sections = theme?.settings?.sections ?? {};

if (sections.hero?.enabled) {
  renderHeroSection(sections.hero);
}

if (sections.featured_products?.enabled) {
  renderFeaturedProducts(sections.featured_products);
}
The shape of settings depends on what your theme defines. Design your theme’s settings schema and document it for shop owners who install your theme.