Skip to main content

Khaime Storefront

Intro

The [khaime_storefront] shortcode renders a server-side product grid — pulled live from your Khaime catalog — on any WordPress page, with filtering, sorting, and multicurrency built in.

Context

This is the entry point of the WordPress Storefront plugin: the grid links out to product detail pages and into the cart, which is either a slide-out drawer or the dedicated Cart Page depending on how cart_display is set. Everything here reads from the same Partner API key configured once in Settings → Khaime.

Download Plugin

khaime-storefront.zip
The storefront is server-rendered. Your Partner API key is configured once in Settings → Khaime — you don’t pass it on the shortcode. The JS SDK only loads when a shopper clicks Proceed to checkout.

Hows

Basic usage

Filter by category

Show only products from a specific category. You can filter by category ID or by slug/name — whichever is more convenient. By ID (numeric, from your Khaime dashboard):
By slug (URL-friendly, lowercase-with-dashes):
By name (case-insensitive, matches even if no slug is set):
Multiple categories (comma-separated):
Combine with other filters to narrow results further:
If category_slug matches no categories, the result is empty — the filter is not silently dropped. This guards against typos returning the full catalog.

Full example

Attributes

Legacy attributes from the v1 JS plugin (theme, spacing, card_style, primary_color, sandbox, merchant_id, hover_effect, etc.) are accepted and silently ignored so existing shortcodes don’t error after the upgrade. They no longer have any effect — remove them when you next touch the page.

Admin settings

Most setup happens once at Settings → Khaime:
KHAIME_API_URL / KHAIME_SDK_URL — overriding the API/SDK host — are wp-config.php constants for local development or staging, not settings-page fields. They show up read-only under Developer overrides on the settings page when defined.

Cart display

The storefront includes a cart icon. By default it opens a slide-out drawer. To send shoppers to a dedicated cart page instead, set cart_display to page (either globally in Settings → Khaime → Cart display or per-instance on the shortcode). See the Cart Page guide for setup. Separately, the optional floating cart button (off by default) adds a persistent cart icon to every page, independent of which cart display mode is active.

Theming

The storefront ships with a fixed, light color palette (surfaces, text, hairlines) so it renders consistently regardless of your theme. The one themeable piece is the accent color used for buttons, the currency switcher, and selected states — set it once in Settings → Khaime → Primary color; leave it empty to use the built-in default. There’s no per-shortcode theme override — styling stays consistent with the storefront’s own admin setting, not the shortcode instance.

CSS customization

Override styles using the khaime- prefix:

Whys

The grid is server-rendered rather than a client-side app because product data, pricing, and category filters can then be produced in one pass on the server — no loading spinner, no layout shift while a script fetches and renders products after the page has already painted. Deferring the JS SDK until the customer actually clicks “Proceed to checkout” follows the same logic in reverse: checkout genuinely needs a script-driven modal (payment element, redirect handling), but the browsing experience doesn’t, so nothing pays that cost until it’s needed. Authenticating with a partner key instead of a numeric merchant ID means the same field also tells the plugin which environment to use — a pk_sandbox_ key can’t accidentally be paired with a “Live” setting for a different merchant, because the two are the same credential.

Why nots

  • Not a full storefront theme. It’s a shortcode-rendered grid meant to sit inside your existing WordPress pages and theme — it doesn’t provide its own site chrome, homepage, or navigation.
  • No per-shortcode currency configuration beyond show_currency. Which currencies are offered is controlled once, account-wide, in Settings → Khaime → Enabled currencies — you can’t offer a different currency set per shortcode instance.
  • Legacy v1 shortcode attributes are ignored, not migrated. If your shortcodes still carry theme, merchant_id, or similar v1 attributes, they’re silently dropped rather than translated to current settings — update them by hand.
  • category_slug typos return an empty grid, not the full catalog. This is intentional (see the note above), but it means a stale or misspelled slug will look like “no products” rather than falling back to showing everything.