Free Core v1.0.0 & Pro Add-on v1.0.0

TradeBlock Checkout Technical Documentation

Installation steps, public PHP filters, Store API contracts, React SlotFills, and Pro v1 JSON rule schema for WooCommerce Block Checkout and HPOS.

1. Installing Free Core & Pro Add-on

  1. Install and activate WooCommerce (with HPOS and the native Checkout block enabled; compatible with WordPress 6.6–7.1+ and WooCommerce 11.3 / 11.4 lazy-loaded block integration).
  2. Install and activate TradeBlock Checkout for WooCommerce (Free Core, GPLv2+).
  3. Open your Checkout page in the Block Editor. Insert TradeBlock B2B Fields directly inside Checkout Fields (after address or contact blocks), and insert TradeBlock Order Bump inside Checkout Totals or near Payment. Save the page.
  4. Configure field visibility, dynamic fees, and the offer product under WooCommerce → TradeBlock Checkout.
  5. Optional Pro Add-on: Keep Free Core active, install tradeblock-checkout-pro.zip as a separate plugin, and configure EU VIES, multi-condition rules, MOQ/Net-30, and your Creem license under WooCommerce → TradeBlock Pro.

WooCommerce 11.4+ lazy-loaded block integration & safe rollback

Server-side Store API and order hooks register independently of block rendering. Deactivating Pro preserves your rule package and local statistics while Free Core continues operating normally.

2. Store API Extension Contracts

Free Core registers the tradeblock-checkout Store API extension namespace:

Surface Key / Action Payload & Storage Behavior
Checkout Request extensions['tradeblock-checkout'] Accepts is_business (boolean), company_name, vat_number, and po_number (strings). Persisted via HPOS order CRUD as _tbcwc_is_business, _tbcwc_company_name, _tbcwc_vat_number, and _tbcwc_po_number. Preserved on Order Pay routes.
Cart Response extensions['tradeblock-checkout'] Exposes applied_fees, vat_status (status, exempt), and bumps.
Cart Update sync_payment Accepts payment_method to synchronize the active payment gateway before fee calculation. Never loaded in the Block Editor.
Cart Update toggle_bump Accepts rule_id and boolean in_cart (desired state) to add or remove the offer inline without page refresh.

3. Public PHP Hooks (Free Core)

Hook Name Signature Purpose
tbcwc_vat_meta_key ($meta_key, $order) Filters the order meta key used to store the VAT number (default _tbcwc_vat_number).
tbcwc_validate_b2b_payload ($result, $payload, $order) Validates sanitized billing-only data on business orders. Return a WP_Error to stop checkout. Core performs no remote VAT validation.
tbcwc_store_api_cart_data ($data, $cart) Extends the Store API cart extension payload returned to Checkout Blocks.
tbcwc_active_order_bumps ($rules, $cart) Filters active offer rules with rule_id, product_id, and optional variation_id.
tbcwc_store_api_update_action ($action, $data) Observes accepted Store API update callbacks (sync_payment, toggle_bump).
tbcwc_fee_rule_matched ($matched, $rule, $cart) Filters whether a checkout fee rule matches the current cart.
tbcwc_fee_amount ($amount, $rule, $cart) Filters the positive net fee amount applied to the cart.

4. React SlotFills

Extend Free Core blocks declaratively without patching core assets:

  • tbcwc.checkout.billing.after — Registered via wc.blocksCheckout.createSlotFill(name).Fill inside wp.plugins.registerPlugin() in scope woocommerce-checkout. Receives current billing fields, the Woo per-field setter, and the validation store key. Add-ons performing async checks should lock submission with disableCheckoutFor and apply a bounded timeout.
  • tbcwc.checkout.bump.after — Same checkout scope; receives bumps and the serialized updateCart helper.
  • tbcwc.admin.rule_conditions — Uses WordPress wp.components.Fill in scope tradeblock-checkout-admin on the Checkout Fees settings page; receives the current settings form.

5. Pro Add-on: VIES & Version-1 JSON Rule Package

Under WooCommerce → TradeBlock Pro → Rules, configure vies.requester_vat with your shop’s registered EU VAT ID (using EL for Greece) so VIES returns a formal requestIdentifier. Valid/invalid VIES results are cached for 24 hours; outages for 1 hour. You can export, edit, and re-import schema-validated version-1 JSON packages across stores:

{
  "version": 1,
  "vies": { "fallback": "allow_with_review", "requester_vat": "" },
  "fees": [
    {
      "id": "wholesale-tier",
      "name": "Wholesale discount",
      "type": "percentage",
      "amount": -10,
      "taxable": true,
      "tax_class": "",
      "match": "AND",
      "conditions": [
        { "field": "role", "values": ["wholesale"] },
        { "field": "quantity", "min": 10, "max": null }
      ]
    }
  ],
  "bumps": [
    {
      "id": "accessory",
      "product_id": 42,
      "variation_id": 0,
      "discount_percent": 20,
      "match": "OR",
      "conditions": [
        { "field": "billing_country", "values": ["DE", "FR"] },
        { "field": "product_category", "values": [7] }
      ]
    }
  ],
  "b2b": {
    "moq": [{ "role": "wholesale", "minimum": 100 }],
    "bacs_roles": ["wholesale"],
    "net30_roles": ["wholesale"]
  }
}

6. Licensing & Updates Architecture

Activate, validate, or release a site under WooCommerce → TradeBlock Pro → License. Valid licenses unlock native WordPress plugin updates from tradeblock-api.packdemo.com. The license API is never contacted during customer checkout, order processing, or offer counting—if a license expires or the license server is unreachable, updates pause while installed features continue working.