Skip to content

WooCommerce v2 query loops and dynamic tags

Bricks 2.4 adds WooCommerce-specific query loops and dynamic tags for advanced modular Cart, Checkout, and My Account layouts.

Use them when you build with WooCommerce advanced modular elements, or when you need a custom cart-dependent layout such as a mini cart inside the Dynamic fragment element.

Use these query loop types from the Query type control. wooCart is the existing Cart contents loop. The other query types are added for advanced modular layouts and only appear when advanced modular elements are enabled.

Query typeBuilder labelUse it for
wooCartCart contentsVisible cart line items. Use for cart rows and custom mini cart item rows.
wooCartCouponsCheckout : Applied couponsApplied cart coupons.
wooCartFeesCheckout : Applied feesCart fees.
wooCartTaxesCheckout : Applied taxesCart tax rows.
wooOrderItemsOrder : Order itemsLine items from the current order context.
wooOrderTotalsOrder : Order totalsOrder total rows from the current order context.
wooOrderDownloadsOrder : Order downloadsDownloadable items from the current order context.
wooOrderCustomerNotesOrder : Customer notesCustomer notes from the current order context.
wooAccountOrdersAccount : OrdersCustomer orders in the Account orders state.
wooAccountOrderActionsAccount : Order actionsAvailable actions for the current order inside a wooAccountOrders loop.
wooAccountDownloadsAccount : DownloadsDownloads available to the current account.
wooAccountAddressesAccount : AddressesBilling and shipping address rows in the Account addresses state.

Order loops use the current order context. That context exists in Checkout v2 pay, thank-you, and order receipt states, in Account v2 view-order states, and inside order-aware account loops.

Use these tags inside the wooCart query loop:

  • {woo_cart_product_name} - Cart item product name, including WooCommerce cart item metadata.
  • {woo_cart_remove_link} - Remove link markup. Use {woo_cart_remove_link:url} when you only need the remove URL.
  • {woo_cart_quantity} - Quantity input. Use {woo_cart_quantity:value} for the numeric quantity.
  • {woo_cart_subtotal} - Cart line subtotal.

You can also use product tags inside the wooCart loop, such as {featured_image}, {woo_product_price}, {woo_product_sku}, and {woo_product_gtin}.

These tags can be used in cart, checkout, and cart-dependent fragments without being inside the wooCart loop:

  • {woo_cart_items_count}
  • {woo_cart_order_subtotal}
  • {woo_cart_order_total}
  • {woo_cart_applied_coupon_total_amount}
  • {woo_cart_applied_fee_total_amount}
  • {woo_cart_shipping_method}
  • {woo_cart_shipping_total_amount}
  • {woo_free_shipping_min_amount}
  • {woo_free_shipping_remaining}
  • {woo_free_shipping_progress}
  • {woo_checkout_current_step_number}
  • {woo_url}

Some tags support :value to return a plain number instead of formatted WooCommerce HTML, such as {woo_cart_shipping_total_amount:value} and {woo_free_shipping_progress:value}.

Query loopTags
wooCartCoupons{woo_cart_applied_coupon}, {woo_cart_applied_coupon_amount}
wooCartFees{woo_cart_applied_fee}, {woo_cart_applied_fee_amount}
wooCartTaxes{woo_cart_applied_tax_label}, {woo_cart_applied_tax_amount}

Use the total tags outside the loop when you only need a combined value:

  • {woo_cart_applied_coupon_total_amount}
  • {woo_cart_applied_fee_total_amount}

Use {woo_url} to output common WooCommerce page and endpoint URLs. Without a key, it returns the shop URL.

TagReturns
{woo_url} or {woo_url:shop}Shop page URL
{woo_url:cart}Cart page URL
{woo_url:checkout}Checkout page URL
{woo_url:account} or {woo_url:myaccount}My Account page URL
{woo_url:dashboard}My Account dashboard endpoint URL
{woo_url:orders}My Account orders endpoint URL
{woo_url:downloads}My Account downloads endpoint URL
{woo_url:addresses} or {woo_url:edit-address}My Account edit-address endpoint URL
{woo_url:edit-account}My Account edit-account endpoint URL
{woo_url:payment-methods}My Account payment methods endpoint URL
{woo_url:add-payment-method}My Account add payment method endpoint URL
{woo_url:lost-password}My Account lost password endpoint URL
{woo_url:customer-logout}My Account logout endpoint URL
{woo_url:terms}WooCommerce terms and conditions page URL
{woo_url:privacy}WooCommerce privacy policy page URL

Registered WooCommerce account endpoint query vars can also be resolved by key. This only returns a URL; it does not add custom Account v2 states.

Use these tags in Account v2 states.

ContextTags
Account addresses state{woo_account_addresses_description}
wooAccountAddresses query loop{woo_account_address_type}, {woo_account_address_title}, {woo_account_address}, {woo_account_address_has_address}, {woo_account_address_edit_url}, {woo_account_address_action_label}
Account edit-address state{woo_account_edit_address_title}, {woo_account_edit_address_type}, {woo_account_edit_address_type_label}

Use these tags in Checkout v2 order states, Account v2 order states, or order-aware query loops.

General order tags:

  • {woo_order_id}
  • {woo_order_number}
  • {woo_order_date}
  • {woo_order_status}
  • {woo_order_total}
  • {woo_order_payment_title}
  • {woo_order_email}
  • {woo_order_checkout_payment_url}
  • {woo_order_again_url}
  • {woo_order_user_id}
  • {woo_order_billing_address}
  • {woo_order_billing_phone}
  • {woo_order_shipping_address}
  • {woo_order_shipping_phone}
  • {woo_order_view_url}
  • {woo_order_view_aria_label}
  • {woo_order_item_count}
  • {woo_order_total_with_item_count}

Use these inside wooOrderItems:

  • {woo_order_item_name}
  • {woo_order_item_quantity}
  • {woo_order_item_price}
  • {woo_order_item_line_subtotal}
  • {woo_order_item_meta}

Use these inside wooOrderTotals:

  • {woo_order_total_label}
  • {woo_order_total_value}

Use these inside wooAccountOrderActions, usually inside a wooAccountOrders loop:

  • {woo_order_action_url}
  • {woo_order_action_name}
  • {woo_order_action_aria_label}

Use these inside wooOrderDownloads or wooAccountDownloads:

  • {woo_order_download_product}
  • {woo_order_download_name}
  • {woo_order_download_url}
  • {woo_order_downloads_remaining}
  • {woo_order_download_access_expires}

Use these inside wooOrderCustomerNotes:

  • {woo_order_customer_note_date}
  • {woo_order_customer_note_comment}

Bricks 2.4 adds WooCommerce conditions for checkout and order-aware layouts:

  • Checkout : Needs shipping address
  • Checkout : Order has status
  • Order : Needs shipping address
  • Order : Has downloads

Use them to show or hide content inside checkout steps, thank-you/order receipt layouts, view-order screens, and other order-aware sections.

Advanced modular WooCommerce layouts also add two interaction triggers:

  • Bricks dynamic fragments refreshed - Runs after Dynamic fragment content has been refreshed.
  • Bricks checkout step changed - Runs after a Checkout v2 step changes.

The Checkout step interaction action can move a multistep checkout to the next step, previous step, a specific step, or a specific checkout field. It can also scroll the target step or field into view.

See Checkout v2 multistep checkout for the full multistep workflow.

Developers can listen for the same frontend events:

document.body.addEventListener('bricks/woocommerce/fragments/refreshed', (event) => {
console.log(event.detail.fragments)
})
document.body.addEventListener('bricks/woocommerce/checkout-step-changed', (event) => {
console.log(event.detail.stepId)
})