Skip to content

Store dynamic data

With the FluentCart or WooCommerce module on, three groups join VX's dynamic data and work everywhere VX Script runs: the Elementor tags and picker, visibility rules, Gutenberg block bindings, and Bricks.

The paths are the same for both stores on purpose, so a site that switches keeps its pages working.

In the VX picker

FolderUnder
ProductPost
Product › VariationPost
CartUser
CustomerUser

@product(…)

The product the page is about — or the product a loop row pinned.

PathType
idnumber
titletext
pricenumber
price_formattedtextWith the currency
price_maxnumberThe top of a range
price_max_formattedtext
price_rangetextThe whole range as text
compare_pricenumberThe compare-at price
compare_price_formattedtext
on_saleyes/no
stock_statustext
in_stockyes/no
stock_quantitynumber
skutext
fulfillmenttextPhysical or digital
variation_typetextSimple or variable
is_variableyes/no
is_subscriptionyes/no
has_subscriptionyes/noAny variation is a subscription
purchase_urlURL
view_urlURL
categoriestext
variations_countnumber
thumbnailURLThe product image. thumbnail.id gives the attachment id

compare_price is the compare-at price on FluentCart and the regular price on WooCommerce, so a sale price and its struck-through original read the same way on both.

WooCommerce also has

PathType
price_htmltextWooCommerce's own price markup, ranges and "From" prefixes included

price_html for Woo stores

WooCommerce renders strikethrough sale prices, ranges, and "From" prefixes in its own markup. Binding a heading to @product(price_html) gives you exactly what a Woo theme shows, currency formatting included.

@product(variations) — a loop source

@product(variations) is loopable. Put it on a loop and read the current row with @product(variation.…):

PathType
idnumber
titletext
descriptiontext
price, price_formattednumber, text
compare_price, compare_price_formattednumber, text
on_saleyes/no
skutext
stock_status, in_stock, stock_quantitytext, yes/no, number
payment_typetext — one-time or subscription
is_subscriptionyes/no
billing_termstext
purchase_urlURL
fulfillmenttext
imageURL — the variation's own image

On WooCommerce a variation's title is built from its attributes, and name is available alongside it.

@product(variation.…) outside a loop reads the product's default variation, which is the tidiest way to show a starting price.

A variations table in four steps

  1. Add a container with one row of elements — name, price, stock, a buy link.
  2. Set the container's VX Loop source to @product(variations).
  3. Bind the elements to @product(variation.title), @product(variation.price_formatted), and @product(variation.purchase_url).
  4. Add a visibility rule on the row so out-of-stock variations drop out.

@cart(…)

The visitor's own cart.

PathType
itemsnumberLine items
countnumberTotal quantity
subtotalnumber
subtotal_formattedtext
checkout_urlURL
has_itemsyes/no
has_productyes/noThe cart holds the product this page is about

WooCommerce also has

PathType
total, total_formattednumber, text
cart_urlURL

@customer(…)

Whoever is looking at the page.

PathType
is_customeryes/noHas ever bought anything
has_boughtyes/noHas bought the product this page is about
has_subscriptionyes/noHas an active subscription to it
ordersnumber
spentnumber
spent_formattedtext
sincedateCustomer since
last_orderdateWooCommerce only

is_customer, has_bought, and has_subscription are also what the matching visibility rules test, so use the rules to show and hide and the tags to print.

On WooCommerce, has_subscription needs WooCommerce Subscriptions.

Visibility rules

Eight store rules join VX's own rule catalog, available on any element's VX Visibility section:

RuleAbout
Product is in stockThe product
Product is on saleThe product
Product is a subscriptionThe product
Viewer has bought this productThe viewer
Viewer has an active subscriptionThe viewer
Viewer is a customerThe viewer
Cart has itemsThe cart
Cart holds this productThe cart

The rule ids are shared between the two modules, so rules built on a FluentCart site keep working if the site moves to WooCommerce, and the other way round.

Things these make easy

GoalRule
A download link only for buyersViewer has bought this product
A "back in stock" noticeHide when Product is in stock
A sale badgeShow when Product is on sale
A "resume checkout" barShow when Cart has items
A members-only blockShow when Viewer has an active subscription
A first-order couponHide when Viewer is a customer

Bricks

VX's own Bricks integration publishes fields only, so the store data arrives in Bricks as dynamic tags of its own, in Product, Product variation, Cart, and Customer groups in the builder's picker:

{vxm_product_price_formatted}
{vxm_product_variation_title}
{vxm_cart_count}
{vxm_customer_has_bought}

The naming is mechanical: @product(variation.title) becomes {vxm_product_variation_title}, so anything in the tables above has a Bricks tag.

Built by Code Wattz.