Skip to content
  1. Extras
  2. mxHeadless
  3. Extensions
  4. MiniShop3

MiniShop3

MiniShop3 connects through the Extension API. mxHeadless core has no shop dependency. MS3 docs on this site: /components/minishop3/.

Typical objects

Public nameDescription
productsProducts (price, SKU, options)
categoriesCategories
ordersOrders (protected, not public)
order_addressesAddresses
product_optionsOptions
product_linksLinks / upsell

Orders need scope orders.read (pattern {name}.read) and ACL. Never public.

Registration example

php
<?php
use MxHeadless\Definition\ObjectDefinition;
use MxHeadless\Definition\RelationDefinition;

/** @var \MxHeadless\Extension\ExtensionApi $api */
$api = $modx->event->params['api'];

$api->registerObject(
    ObjectDefinition::create('products')
        ->setName('products')
        ->class('MiniShop3\\Model\\msProduct')
        ->fields(['id', 'pagetitle', 'alias', 'uri', 'price', 'article', 'parent', 'published'])
        ->filterable(['id', 'parent', 'price', 'published', 'article'])
        ->sorts(['id', 'price', 'pagetitle'])
        ->readable()
);

$api->registerRelation('products', RelationDefinition::create('category')
    ->to('categories')
    ->toOne()
    ->foreignKeyField('parent')
    ->fields(['id', 'pagetitle', 'alias'])
);

Full example with orders is in the repository.

Storefront

bash
# Category grid
curl -s 'https://example.com/api/v1/objects/products?filter[parent]=15&filter[published]=1&sort=price&limit=24'

# Product with category
curl -s 'https://example.com/api/v1/objects/products/101?include=category'

Two APIs

mxHeadlessMiniShop3 Web API
PurposeCatalog, CMS, admin ordersCart, checkout, customer token
Entry/api/v1/...assets/components/minishop3/api.php?route=/api/v1/...
Envelope{ data, meta, links }{ success, message, data, ... }

Pretty URL /api/v1/cart/... is intercepted by mxHeadless → 404. Call cart via api.php?route=.

CORS: align mxheadless_cors_* and ms3_cors_allowed_origins.

Frontend

Two base URLs (cms + shop), a BFF, or careful nginx split. Nuxt/Next guides: docs/examples in the repository.