Skip to content

Public Shop API

Public endpoints for browsing the product catalog, viewing products, and searching. No authentication required.

Base URL: https://your-site.com/wp-json/fluent-cart/v2/public

Policy: PublicPolicy (no authentication required)


List Products

GET /fluent-cart/v2/public/products

Retrieve a paginated list of published products with optional filtering by taxonomy terms, price range, product type, and more. Only products with publish status are returned. Product post_content and sensitive detail fields (item_cost, editing_stage, stock, manage_stock, manage_cost, settings) are hidden from the response.

Parameters

ParameterTypeLocationRequiredDescription
per_pageintegerqueryNoNumber of products per page (default: 10)
current_pageintegerqueryNoPage number for offset-based pagination
cursorstringqueryNoCursor token for cursor-based pagination
paginate_usingstringqueryNoPagination strategy: cursor for cursor-based, omit for offset-based
order_typestringqueryNoSort direction: ASC or DESC (default: DESC)
witharrayqueryNoRelations to eager load (e.g., ["detail"])
allow_out_of_stockbooleanqueryNoInclude out-of-stock products (default: false)
include_idsarrayqueryNoOnly return products with these IDs (max 100 IDs)
exclude_idsarrayqueryNoExclude products with these IDs (max 100 IDs)
product_typestringqueryNoFilter by product type. Values: physical, digital, subscription, onetime, simple, simple_variations
on_salebooleanqueryNoOnly return products currently on sale (compare price > item price)
default_filtersobjectqueryNoShortcode-level filters applied as defaults (see filter fields below)
filtersobjectqueryNoInteractive user-applied filters (override defaults). See filter fields below

Filter Fields (within default_filters and filters)

FieldTypeDescription
wildcardstringSearch by product title
enable_wildcard_for_post_contentintegerSet to 1 to also search product content
sort_bystringSort preset: name-asc, name-desc, price-low, price-high, date-newest, date-oldest
price_range_fromfloatMinimum price filter (in decimal, e.g., 10.00)
price_range_tofloatMaximum price filter (in decimal, e.g., 99.99)
{taxonomy_slug}string/arrayFilter by taxonomy term IDs (e.g., product-categories)

Response

json
{
  "products": {
    "products": {
      "total": 24,
      "per_page": 10,
      "current_page": 1,
      "last_page": 3,
      "data": [
        {
          "ID": 42,
          "post_title": "Premium T-Shirt",
          "post_status": "publish",
          "post_excerpt": "High-quality cotton t-shirt",
          "guid": "https://example.com/?p=42",
          "view_url": "https://example.com/product/premium-t-shirt",
          "has_subscription": false,
          "thumbnail": "https://example.com/wp-content/uploads/tshirt.jpg",
          "detail": {
            "id": 15,
            "post_id": 42,
            "variation_type": "simple",
            "min_price": 2500,
            "max_price": 2500,
            "fulfillment_type": "physical"
          }
        }
      ]
    },
    "total": 24
  }
}

INFO

Product prices (min_price, max_price) are returned in cents (integer). Divide by 100 to get the decimal amount.

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/public/products?per_page=12&filters[sort_by]=price-low&filters[price_range_from]=10&filters[price_range_to]=50"

Get Product Views (HTML)

GET /fluent-cart/v2/public/product-views

Retrieve server-rendered HTML views of product listings. Used by Gutenberg blocks and shortcodes for AJAX-powered product grids. Returns pre-rendered HTML along with pagination metadata, eliminating the need for client-side template rendering.

Parameters

ParameterTypeLocationRequiredDescription
per_pageintegerqueryNoNumber of products per page (default: 10)
current_pageintegerqueryNoCurrent page number (default: 1)
template_providerstringqueryNoTemplate provider identifier for custom rendering via the fluent_cart/products_views/preload_collection_{provider} filter
client_idstringqueryNoClient identifier used to retrieve cached block markup from transients
...all parameters from List ProductsAll product filtering parameters are also supported

Response

When a template provider or cached markup is available:

json
{
  "products": {
    "views": "<div class=\"fct-product-card\">...rendered HTML...</div>",
    "current_page": 1,
    "last_page": 3,
    "total": 24,
    "per_page": 10,
    "from": 1,
    "to": 10
  }
}

When falling back to default rendering:

json
{
  "products": {
    "views": "<div class=\"fct-product-card\">...rendered HTML...</div>",
    "total": 24,
    "last_page": 3,
    "per_page": 10,
    "from": 1,
    "to": 10,
    "page": 1,
    "current_page": 1
  }
}

Rendering Priority

The endpoint uses the following priority to determine how products are rendered:

  1. Template Provider -- If template_provider is set, the fluent_cart/products_views/preload_collection_{provider} filter is called. If a view is returned, it is used immediately.
  2. Cached Block Markup -- If client_id is set and a matching transient exists (fct_product_loop_client_{client_id}), the cached Gutenberg block markup is processed with do_blocks().
  3. Default Renderer -- Falls back to ProductListRenderer for standard server-side rendering.

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/public/product-views?per_page=12&current_page=2&filters[sort_by]=date-newest"

Search Products

GET /fluent-cart/v2/public/product-search

Search for published products by title and return server-rendered HTML search result items. Designed for use with the storefront search bar component.

Parameters

ParameterTypeLocationRequiredDescription
post_titlestringqueryYesThe search query string to match against product titles
url_modestringqueryNoURL mode passed to the SearchBarRenderer to control how product links are generated
termIdintegerqueryNoFilter search results to products within a specific taxonomy term (category) ID

Response

json
{
  "htmlView": "<div class=\"fct-search-result-item\"><a href=\"https://example.com/product/premium-t-shirt\">Premium T-Shirt</a></div>..."
}

INFO

The response contains pre-rendered HTML for direct insertion into the search results dropdown. The HTML structure is generated by SearchBarRenderer and includes product titles, links, and taxonomy term badges.

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/public/product-search?post_title=shirt&termId=5"

FluentCart developer documentation