Woo blocks

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Woo blocks is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Build WooCommerce Blocks — Gutenberg block integration, block-based cart/checkout extensions, Store API, and the @woocommerce/blocks-checkout package. Use when extending the block editor for WooCommerce or customizing block-based checkout/cart.

How to use this skill

Skill file

WooCommerce Blocks Development

Before writing code

Fetch live docs:

  1. Web-search site:developer.woocommerce.com blocks extensibility for blocks extension docs
  2. Fetch https://developer.wordpress.org/block-editor/ for Block Editor handbook
  3. Web-search woocommerce checkout blocks extension api for checkout extension patterns

Architecture Overview

What WooCommerce Blocks Are

React-based blocks for the WordPress block editor (Gutenberg):

Store API

A dedicated REST API powering the block-based cart and checkout:

Key Packages

| Package | Purpose |

|---------|---------|

| @woocommerce/blocks-checkout | Checkout extension API |

| @woocommerce/blocks-registry | Block type registration |

| @woocommerce/blocks-components | Shared React components |

| @woocommerce/settings | Access WC settings in JS |

| @wordpress/blocks | Core block registration |

| @wordpress/block-editor | Editor components |

| @wordpress/element | React wrapper |

Extending Checkout Blocks

Integration Points

The block-based checkout provides extension points:

Checkout Extension API (PHP Side)

Use ExtendSchema and StoreApi classes to:

  1. Extend the Store API response with custom data
  2. Add custom endpoint data to cart items, shipping, or checkout
  3. Process custom data during checkout via ExtendSchema::register_endpoint_data()

Checkout Extension API (JS Side)

Use @woocommerce/blocks-checkout exports:

Registering a Checkout Block

  1. Register the block server-side with register_block_type()
  2. Declare the block as a checkout inner block via BlockRegistry
  3. Provide edit and save React components
  4. Enqueue scripts for the frontend and editor

Building Custom Product Blocks

Block Registration

Register with register_block_type():

Server-Side Rendering

Use dynamic blocks with render_callback or render.php for product data:

Store API Extension

Adding Custom Data to Cart/Checkout

Register custom data via woocommerce_blocks_loaded action:

Processing Custom Checkout Data

Register checkout_data processing via woocommerce_store_api_checkout_update_order_from_request:

Declaring Block Compatibility

add_action( 'before_woocommerce_init', function() {
    if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
            'cart_checkout_blocks', __FILE__, true
        );
    }
});

Best Practices

Fetch the WooCommerce Blocks extension docs and Block Editor handbook for exact API methods, slot names, and filter signatures before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.