bricks_create_woo_template

Phase 3AdvancedComplexity: 7/10
Create a WooCommerce template (18+ types: product, cart, checkout, etc.)

Overview

Creates a WooCommerce Bricks template for any WC page type. WooCommerce templates control the layout of shop pages, product pages, cart, checkout, account pages, and more.

Supports 17+ template types covering every WooCommerce page: from product archives and single product layouts to cart, checkout, thank-you, and all My Account sub-pages. Each template can have display conditions to target specific products, categories, or the entire site.

This is the foundation tool for building custom WooCommerce storefronts with Bricks Builder. Use it alongside the higher-level product and shop template tools for pre-built layouts.

Key Features

17+ Template Types
Covers every WooCommerce page: wc_archive, wc_product, wc_cart, wc_cart_empty, wc_form_checkout, wc_form_pay, wc_thankyou, wc_order_receipt, plus all My Account sub-pages (dashboard, orders, downloads, addresses, edit forms, login, lost password).
Conditional Display
Assign display conditions so templates apply to specific products, product categories, the entire site, or individual post IDs. Supports include and exclude logic.
Initial Content Support
Optionally pass an initial element tree when creating the template, so it is pre-populated with WooCommerce Bricks elements like product gallery, price, add-to-cart, and tabs.
Bricks WC Elements Integration
Templates work with all WooCommerce-specific Bricks elements (woo-product-gallery, woo-product-price, woo-product-add-to-cart, woo-product-tabs, etc.) and WC dynamic data tags.

When to Use

You need a custom layout for any WooCommerce page type (shop, product, cart, checkout, account)
You want to override default WooCommerce templates with Bricks-powered designs
You need different product page layouts for different product categories
You are building a complete WooCommerce storefront from scratch
You want to customize the checkout or My Account experience
Prerequisites
WooCommerce plugin must be installed and activated
Bricks Builder version 1.9 or higher
At least one WooCommerce product should exist for testing
WooCommerce pages (shop, cart, checkout) should be configured in WooCommerce settings

When NOT to Use

You only need a quick product or shop template — use bricks_create_woo_product_template or bricks_create_woo_shop_template instead
You are not using WooCommerce on the site
You want to edit an existing WC template — use bricks_update_template_content instead

Parameters

4 Total Parameters2 Required2 Optional

Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
typestring (enum)REQUIRED
WooCommerce template type. One of: wc_archive, wc_product, wc_cart, wc_cart_empty, wc_form_checkout, wc_form_pay, wc_thankyou, wc_order_receipt, wc_account_dashboard, wc_account_orders, wc_account_view_order, wc_account_downloads, wc_account_addresses, wc_account_form_edit_address, wc_account_form_edit_account, wc_account_form_login, wc_account_form_lost_password.

Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
titlestringREQUIRED
Template title displayed in the Bricks template list (e.g., "Custom Product Page", "Shop Grid Layout").

Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
contentobjectoptional
Optional initial element tree for the template content. Uses the same hierarchical JSON format as bricks_add_section.
Default: null

Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
conditionsarray of objectsoptional
Display conditions array. Each object has: main (condition type: "any", "frontpage", "postType", "archiveType", "ids", "terms"), postType (array of post types), ids (array of post/product IDs), archiveType (string), exclude (boolean to invert).
Default: []

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Create a custom single product template

Creates a WooCommerce product template with a condition targeting all products.

JSON
bricks_create_woo_template({
  type: "wc_product",
  title: "Modern Product Page",
  conditions: [
    { main: "postType", postType: ["product"] }
  ]
})

Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Create a custom checkout template

Creates a checkout form template applied to the entire site.

JSON
bricks_create_woo_template({
  type: "wc_form_checkout",
  title: "Custom Checkout",
  conditions: [
    { main: "any" }
  ],
  content: {
    type: "section",
    ref: "checkout-section",
    children: [{
      type: "container",
      children: [
        { type: "heading", settings: { tag: "h1", text: "Checkout" } },
        { type: "woo-checkout-form", ref: "checkout-form" }
      ]
    }]
  }
})

Common Mistakes


Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Without conditions, the template will not appear on any page. Always add at least one condition, typically { main: "postType", postType: ["product"] } for product templates or { main: "any" } for site-wide templates.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
WooCommerce has many specific page types. A wc_product template will not affect the cart or checkout pages. Ensure you pick the correct type for the page you want to customize.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Product pages need WooCommerce-specific elements (woo-product-gallery, woo-product-price, woo-product-add-to-cart). Using generic heading/text elements with dynamic tags is possible but less reliable than native WC elements.

Tips & Warnings

Tips & Warnings

Tip: For quick product or shop page creation, prefer bricks_create_woo_product_template or bricks_create_woo_shop_template which pre-build complete layouts with gallery, price, add-to-cart, filters, and pagination.

Tip: Use bricks_woo_status first to verify WooCommerce is active and see existing WC templates. Use bricks_woo_elements to list all available WC-specific Bricks elements.

Warning: Only one template per type can be active at a time (the one with the most specific conditions wins). If you create a new product template, it may override an existing one depending on condition specificity.

Warning: Requires WooCommerce plugin to be installed and active. The tool will fail if WooCommerce is not detected.

Return Values

FieldTypeDescription
template_idnumberThe WordPress post ID of the newly created template.
titlestringThe template title as stored.
typestringThe WooCommerce template type that was created.
conditionsarrayThe display conditions applied to the template.

Related Tools

Technical Details

Tool ID
bricks_create_woo_template
API Endpoint
/woocommerce/templates
HTTP Method
POST
Namespace
woocommerce
Source File
woocommerce/templates.ts
Version
1.0
Min Bricks Version
1.9
Requires Plugin
WooCommerce
Requires Auth
Yes

Changelog

v1.0
Initial release with support for 17+ WooCommerce template types, display conditions, and optional initial content.
20250101