Where geometry comes from
Many suppliers publish geometry in DST, per size, in the same record as the rest of the product data. The DST geometry block has room for:
- Stack (frame_stack)
- Reach (frame_reach)
- Top tube length
- Head tube length
- Head tube angle
- Seat tube length
- Seat tube angle
- Chainstay length
- Wheelbase
- Standover height
- Bottom bracket drop and height
- Fork offset and trail
Coverage differs by brand, so check a few models. BikeDist does not write geometry to your store yet; if you want it to fill the metafield below automatically, tell us. Until then, copy the values from DST or the brand's geometry chart into one JSON value per model:
{
"sizes": ["XS", "S", "M", "L", "XL"],
"rows": [
{ "label": "Stack", "unit": "mm", "values": [520, 538, 556, 576, 598] },
{ "label": "Reach", "unit": "mm", "values": [372, 380, 388, 396, 404] },
{ "label": "Top tube length", "unit": "mm", "values": [515, 530, 545, 560, 578] },
{ "label": "Head tube angle", "unit": "°", "values": [71.0, 72.0, 73.0, 73.5, 73.5] },
{ "label": "Seat tube angle", "unit": "°", "values": [74.5, 74.0, 73.5, 73.5, 73.0] },
{ "label": "Chainstay length", "unit": "mm", "values": [410, 410, 410, 412, 412] },
{ "label": "Wheelbase", "unit": "mm", "values": [975, 982, 990, 1000, 1012] },
{ "label": "Standover height", "unit": "mm", "values": [740, 765, 790, 815, 840] }
]
}The numbers above are an example layout, not a real bike. Keep one column per size in the same order as your size variants, and give each row its unit.
Shopify: a JSON metafield and a theme snippet
- In your Shopify admin go to Settings → Metafields and metaobjects → Products, click Add definition, name it "Geometry" with the key
custom.geometry, and choose the JSON type. - Open a bike product, paste its JSON into the Geometry metafield and save.
- In Online Store → Themes → Edit code, add a snippet named
bike-geometry.liquidwith the code below. - In the theme editor, add a Custom Liquid block to the product template with
{% render 'bike-geometry', product: product %}, and add the CSS to your theme stylesheet.
{%- comment -%} snippets/bike-geometry.liquid {%- endcomment -%}
{%- assign geo = product.metafields.custom.geometry.value -%}
{%- if geo and geo.rows.size > 0 -%}
<section class="bike-geometry">
<h2>Geometry</h2>
<div class="bike-geometry__scroll" role="region" aria-label="Frame geometry" tabindex="0">
<table>
<thead>
<tr>
<th scope="col">Measurement</th>
{%- for size in geo.sizes -%}<th scope="col">{{ size }}</th>{%- endfor -%}
</tr>
</thead>
<tbody>
{%- for row in geo.rows -%}
<tr>
<th scope="row">{{ row.label }}{% if row.unit %} ({{ row.unit }}){% endif %}</th>
{%- for value in row.values -%}<td>{{ value }}</td>{%- endfor -%}
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
</section>
{%- endif -%}.value on a JSON metafield gives you the parsed object, so geo.rows and geo.sizes are ordinary arrays in Liquid. The snippet renders nothing when a product has no geometry, so it is safe on every product page.
WooCommerce: a custom field and a small plugin
- Save the code below as
wp-content/plugins/bike-geometry/bike-geometry.phpand activate Bike geometry table under Plugins. - Edit a bike product. Under Product data → General there is now a Geometry (JSON)field: paste the model's JSON and update the product.
- Add the same CSS to your theme's additional CSS.
<?php
/**
* Plugin Name: Bike geometry table
* Description: Adds a "Geometry (JSON)" field to products and shows it as a table on product pages.
*/
// 1. A field under Product data → General.
add_action( 'woocommerce_product_options_general_product_data', function () {
woocommerce_wp_textarea_input( array(
'id' => 'bike_geometry',
'label' => __( 'Geometry (JSON)', 'bike-geometry' ),
'description' => __( 'Sizes and rows, one column per size.', 'bike-geometry' ),
'desc_tip' => true,
) );
} );
// 2. Save it (WooCommerce has already checked the nonce at this point). Invalid JSON is ignored.
add_action( 'woocommerce_admin_process_product_object', function ( $product ) {
if ( ! isset( $_POST['bike_geometry'] ) ) {
return;
}
$raw = trim( wp_unslash( $_POST['bike_geometry'] ) );
if ( '' === $raw || null !== json_decode( $raw ) ) {
$product->update_meta_data( 'bike_geometry', $raw );
}
} );
// 3. Show the table below the product summary.
add_action( 'woocommerce_after_single_product_summary', function () {
global $product;
if ( ! $product ) {
return;
}
$geo = json_decode( (string) $product->get_meta( 'bike_geometry' ), true );
if ( empty( $geo['rows'] ) || empty( $geo['sizes'] ) ) {
return;
}
echo '<section class="bike-geometry"><h2>' . esc_html__( 'Geometry', 'bike-geometry' ) . '</h2>';
echo '<div class="bike-geometry__scroll" role="region" aria-label="Frame geometry" tabindex="0"><table><thead><tr>';
echo '<th scope="col">' . esc_html__( 'Measurement', 'bike-geometry' ) . '</th>';
foreach ( $geo['sizes'] as $size ) {
echo '<th scope="col">' . esc_html( $size ) . '</th>';
}
echo '</tr></thead><tbody>';
foreach ( $geo['rows'] as $row ) {
$label = $row['label'] . ( isset( $row['unit'] ) ? ' (' . $row['unit'] . ')' : '' );
echo '<tr><th scope="row">' . esc_html( $label ) . '</th>';
foreach ( (array) $row['values'] as $value ) {
echo '<td>' . esc_html( (string) $value ) . '</td>';
}
echo '</tr>';
}
echo '</tbody></table></div></section>';
}, 15 );For many products at once, set the bike_geometry meta data through the WooCommerce REST API (the meta_data field on a product) instead of by hand.
Mobile layout
A table with five or six sizes is wider than a phone. Rather than shrinking the text, let the table scroll sideways and pin the first column, so riders always see which measurement they are reading:
.bike-geometry__scroll { overflow-x: auto; }
.bike-geometry table { border-collapse: collapse; min-width: 32rem; width: 100%; }
.bike-geometry th, .bike-geometry td { padding: .5rem .75rem; border-bottom: 1px solid #e5e7eb; text-align: left; }
.bike-geometry th[scope="row"] { position: sticky; left: 0; background: #fff; font-weight: 600; }The wrapper has role="region", a label and tabindex="0", so keyboard users can scroll it too. Pair the table with a short size guide (rider height per size) above it; that answers the question most buyers actually have. See also what an e-bike product page needs.
Related
- What an e-bike product page needs: 12 specs buyers checkThe 12 specs e-bike buyers compare, from battery Wh and motor torque to the EU 25 km/h limit, and how to show them on Shopify or WooCommerce.
- Bike sizes and colours as Shopify variants: two waysOne product with size and colour variants, or one product per variant? How each works in Shopify and WooCommerce, the SEO effect, and which to pick.
- The Shopify app for bike shops that use DSTInstall BikeDist from the Shopify App Store and publish DST bikes with sizes and colours as variants, EAN barcodes, images and your own prices.
- Import your DST bike catalogue into WooCommerceConnect WooCommerce with a REST API key and export DST bikes as variable products with sizes, colours, images, SKUs and your prices. No extra plugin.