Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

woocommerce-plugin-development

FreeNo executable scriptsNot checked

Create custom WooCommerce plugins using action/filter hooks, the Settings API, and REST API extensions to add features without modifying core

finsilabsby finsilabs★ 69 GitHub stars

About this skill

WooCommerce Plugin Development

Overview

Build custom WooCommerce plugins that extend store functionality using WordPress hooks (actions and filters), the WooCommerce Settings API, custom post types and meta boxes, REST API extensions, and HPOS (High-Performance Order Storage) compatibility. This skill covers plugin architecture, the WooCommerce lifecycle hooks for orders and products, and patterns for building maintainable, upgrade-safe extensions.

When to Use This Skill

  • When building a custom feature that extends WooCommerce (custom shipping, payment, or discount logic)
  • When creating a plugin that adds admin settings and configuration pages
  • When hooking into the WooCommerce checkout, order, or product lifecycle
  • When extending the WooCommerce REST API with custom endpoints
  • When migrating a plugin to support HPOS (High-Performance Order Storage)

Core Instructions

  1. Set up the plugin boilerplate

    <?php
    /**
     * Plugin Name: My Custom WooCommerce Extension
     * Description: Adds custom functionality to WooCommerce
     * Version: 1.0.0
     * Author: Your Name
     * Requires Plugins: woocommerce
     * WC requires at least: 8.0
     * WC tested up to: 9.0
     *
     * @package MyWooExtension
     */
    
    defined('ABSPATH') || exit;
    
    // Check if WooCommerce is active
    if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
        return;
    }
    
    define('MWE_VERSION', '1.0.0');
    define('MWE_PLUGIN_DIR', plugin_dir_path(__FILE__));
    define('MWE_PLUGIN_URL', plugin_dir_url(__FILE__));
    
    // Declare HPOS compatibility
    add_action('before_woocommerce_init', function () {
        if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
                'custom_order_tables',
                __FILE__,
                true
            );
        }
    });
    
    // Initialize the plugin after WooCommerce loads
    add_action('woocommerce_loaded', function () {
        require_once MWE_PLUGIN_DIR . 'includes/class-mwe-main.php';
        MWE_Main::instance();
    });
    
  2. Use WooCommerce hooks for order lifecycle events

    class MWE_Order_Handler {
        public function __construct() {
            // Order status transitions
            add_action('woocommerce_order_status_completed', [$this, 'on_order_completed'], 10, 2);
            add_action('woocommerce_order_status_changed', [$this, 'on_status_change'], 10, 4);
    
            // New order created
            add_action('woocommerce_checkout_order_created', [$this, 'on_order_created']);
    
            // Payment complete
            add_action('woocommerce_payment_complete', [$this, 'on_payment_complete']);
    
            // Before/after order item saved (HPOS compatible)
            add_action('woocommerce_new_order_item', [$this, 'on_new_order_item'], 10, 3);
        }
    
        public function on_order_completed(int $order_id, \WC_Order $order): void {
            // Example: trigger fulfillment via external API
            $items = $order->get_items();
            $shipping_address = $order->get_address('shipping');
    
            foreach ($items as $item) {
                $product = $item->get_product();
                $sku = $product->get_sku();
                $quantity = $item->get_quantity();
    
                // Call your external fulfillment service
                $this->send_to_fulfillment($sku, $quantity, $shipping_address);
            }
    
            $order->add_order_note('Order sent to fulfillment service.');
        }
    
        public function on_status_change(int $order_id, string $from, string $to, \WC_Order $order): void {
            // Log status transitions
            error_log(sprintf(
                'Order #%d transitioned from %s to %s',
                $order_id, $from, $to
            ));
        }
    }
    
  3. Add settings using the WooCommerce Settings API

    class MWE_Settings {
        public function __construct() {
            add_filter('woocommerce_settings_tabs_array', [$this, 'add_settings_tab'], 50);
            add_action('woocommerce_settings_tabs_mwe_settings', [$this, 'render_settings']);
            add_action('woocommerce_update_options_mwe_settings', [$this, 'save_settings']);
        }
    
        public function add_settings_tab(array $tabs): array {
            $tabs['mwe_settings'] = __('My Extension', 'my-woo-extension');
            return $tabs;
        }
    
        public function render_settings(): void {
            woocommerce_admin_fields($this->get_settings());
        }
    
        public function save_settings(): void {
            woocommerce_update_options($this->get_settings());
        }
    
        private function get_settings(): array {
            return [
                [
                    'title' => __('General Settings', 'my-woo-extension'),
                    'type'  => 'title',
                    'id'    => 'mwe_general_set
    
Full SKILL.md on GitHub

Install woocommerce-plugin-development in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

claude-code
cursor
gemini-cli
copilot
codex-cli
kiro
opencode

Bundled files

evals/custom-shipping-method-and-rest-api-endp/criteria.jsonevals/custom-shipping-method-and-rest-api-endp/task.mdevals/plugin-boilerplate-hpos-compatibility-or/criteria.jsonevals/plugin-boilerplate-hpos-compatibility-or/task.mdevals/woocommerce-settings-api-and-product-cus/criteria.jsonevals/woocommerce-settings-api-and-product-cus/task.mdtile.json

FAQ

What does the woocommerce-plugin-development skill do?

Create custom WooCommerce plugins using action/filter hooks, the Settings API, and REST API extensions to add features without modifying core

How do I install the woocommerce-plugin-development skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the woocommerce-plugin-development skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare woocommerce-plugin-development with