Token导航 LogoToken导航

Agent Skill · 前端设计

woocommerce-plugin-development(woocommerce 插件开发)

woocommerce-plugin-development 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

woocommerce-plugin-development 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 5,649。

总安装 630周安装 26GitHub Stars 19下载 206核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:woocommerce-plugin-development(woocommerce 插件开发)
来源仓库:https://github.com/finsilabs/awesome-ecommerce-skills
仓库路径:skills/woocommerce-plugin-development
安装命令:
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill woocommerce-plugin-development
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill woocommerce-plugin-development

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

woocommerce-plugin-development 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适用于 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态或协作事项进行整理的场景。

通过 npx skills add 命令从 finsilabs/awesome-ecommerce-skills 仓库安装,路径为 skills/woocommerce-plugin-development。安装前应确认权限范围、维护状态,并注意是否涉及联网、命令执行或文件读写。

当前分类为前端设计,但功能描述未体现设计能力,建议核实分类准确性。

来源仓库内路径:skills/woocommerce-plugin-development

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill woo…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

woocommerce-plugin-development 怎么安装?

在终端执行 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill woocommerce-p…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

woocommerce-plugin-development 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

woocommerce-plugin-development 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

woocommerce-plugin-development 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

woocommerce-plugin-development 用的人多吗?

公开数据是累计安装 630 次,近一周安装 26 次,下载 206 次,GitHub 19 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

woocommerce-plugin-development 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
woocommerce-plugin-development

woocommerce 插件开发 · 本页

63019接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

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_settings',], ['title' => __('Enable Feature', 'my-woo-extension'), 'desc' => __('Enable the custom feature', 'my-woo-extension'), 'id' => 'mwe_enable_feature', 'type' => 'checkbox', 'default' => 'yes',], ['title' => __('API Key', 'my-woo-extension'), 'desc' => __('Enter your external service API key', 'my-woo-extension'), 'id' => 'mwe_api_key', 'type' => 'text', 'css' => 'min-width: 300px;',], ['title' => __('Processing Mode', 'my-woo-extension'), 'id' => 'mwe_processing_mode', 'type' => 'select', 'options' => ['sync' => __('Synchronous', 'my-woo-extension'), 'async' => __('Asynchronous (Queue)', 'my-woo-extension'),], 'default' => 'sync',], ['type' => 'sectionend', 'id' => 'mwe_general_settings',],];}}
  4. Modify product data with filters class MWE_Product_Customizer {public function __construct() {// Add a custom product tab in admin add_filter('woocommerce_product_data_tabs', [$this, 'add_product_tab']); add_action('woocommerce_product_data_panels', [$this, 'render_product_panel']); add_action('woocommerce_process_product_meta', [$this, 'save_product_meta']); // Modify price display on frontend add_filter('woocommerce_get_price_html', [$this, 'modify_price_display'], 10, 2); // Add custom data to cart item add_filter('woocommerce_add_cart_item_data', [$this, 'add_custom_cart_data'], 10, 3); // Display custom data in cart add_filter('woocommerce_get_item_data', [$this, 'display_cart_item_data'], 10, 2); // Save custom data to order item add_action('woocommerce_checkout_create_order_line_item', [$this, 'save_order_item_meta'], 10, 4);} public function add_product_tab(array $tabs): array {$tabs['mwe_custom'] = ['label' => __('Custom Fields', 'my-woo-extension'), 'target' => 'mwe_custom_product_data', 'class' => [], 'priority' => 80,]; return $tabs;} public function render_product_panel(): void {global $post; echo '<div id="mwe_custom_product_data" class="panel woocommerce_options_panel">'; wp_nonce_field('mwe_save_product_meta', 'mwe_product_meta_nonce'); woocommerce_wp_text_input(['id' => '_mwe_custom_field', 'label' => __('Custom Field', 'my-woo-extension'), 'description' => __('Enter a custom value for this product', 'my-woo-extension'), 'desc_tip' => true,]); woocommerce_wp_select(['id' => '_mwe_product_badge', 'label' => __('Product Badge', 'my-woo-extension'), 'options' => ['' => __('None', 'my-woo-extension'), 'new' => __('New', 'my-woo-extension'), 'sale' => __('Sale', 'my-woo-extension'), 'limited' => __('Limited Edition', 'my-woo-extension'),],]); echo '</div>';} public function save_product_meta(int $post_id): void {// Verify nonce before processing $_POST data if (!isset($_POST['mwe_product_meta_nonce']) ||!wp_verify_nonce($_POST['mwe_product_meta_nonce'], 'mwe_save_product_meta')) {return;} $custom_field = sanitize_text_field($_POST['_mwe_custom_field']?? ''); update_post_meta($post_id, '_mwe_custom_field', $custom_field); $badge = sanitize_text_field($_POST['_mwe_product_badge']?? ''); update_post_meta($post_id, '_mwe_product_badge', $badge);}}
  5. Extend the WooCommerce REST API class MWE_REST_Controller {public function __construct() {add_action('rest_api_init', [$this, 'register_routes']);} public function register_routes(): void {register_rest_route('mwe/v1', '/analytics/summary', ['methods' => \WP_REST_Server::READABLE, 'callback' => [$this, 'get_analytics_summary'], 'permission_callback' => [$this, 'check_admin_permission'],]); register_rest_route('mwe/v1', '/products/(?P<id>\d+)/custom-data', ['methods' => \WP_REST_Server::READABLE, 'callback' => [$this, 'get_product_custom_data'], 'permission_callback' => '__return_true', 'args' => ['id' => ['validate_callback' => function ($param) {return is_numeric($param);},],],]);} public function check_admin_permission(\WP_REST_Request $request): bool {return current_user_can('manage_woocommerce');} public function get_analytics_summary(\WP_REST_Request $request): \WP_REST_Response {$days = absint($request->get_param('days')?? 30); $date_from = date('Y-m-d', strtotime("-{$days} days")); // HPOS-compatible order query $orders = wc_get_orders(['date_created' => ">={$date_from}", 'status' => ['wc-completed', 'wc-processing'], 'limit' => -1, 'return' => 'ids',]); $total_revenue = 0; foreach ($orders as $order_id) {$order = wc_get_order($order_id); $total_revenue += (float) $order->get_total();} return new \WP_REST_Response(['period' => "{$days}_days", 'total_orders' => count($orders), 'total_revenue' => $total_revenue, 'avg_order' => count($orders) > 0? $total_revenue / count($orders): 0,]);}}
  6. Create a custom shipping method // Register the shipping method add_filter('woocommerce_shipping_methods', function (array $methods): array {$methods['mwe_custom_shipping'] = 'MWE_Custom_Shipping_Method'; return $methods;}); class MWE_Custom_Shipping_Method extends \WC_Shipping_Method {public function __construct(int $instance_id = 0) {$this->id = 'mwe_custom_shipping'; $this->instance_id = absint($instance_id); $this->method_title = __('Custom Shipping', 'my-woo-extension'); $this->method_description = __('Custom shipping rate calculation', 'my-woo-extension'); $this->supports = ['shipping-zones', 'instance-settings']; $this->init();} public function init(): void {$this->init_form_fields(); $this->init_settings(); $this->title = $this->get_option('title', 'Custom Shipping'); $this->enabled = $this->get_option('enabled', 'yes');} public function init_form_fields(): void {$this->instance_form_fields = ['title' => ['title' => __('Method Title', 'my-woo-extension'), 'type' => 'text', 'default' => 'Custom Shipping',], 'base_cost' => ['title' => __('Base Cost', 'my-woo-extension'), 'type' => 'price', 'default' => '5.00',], 'per_item_cost' => ['title' => __('Per Item Cost', 'my-woo-extension'), 'type' => 'price', 'default' => '1.00',],];} public function calculate_shipping($package = []): void {$base_cost = (float) $this->get_option('base_cost', 5); $per_item = (float) $this->get_option('per_item_cost', 1); $item_count = 0; foreach ($package['contents'] as $item) {$item_count += $item['quantity'];} $cost = $base_cost + ($per_item * $item_count); $this->add_rate(['id' => $this->get_rate_id(), 'label' => $this->title, 'cost' => $cost,]);}}

Examples

Custom WooCommerce email notification

class MWE_Custom_Email extends \WC_Email {
    public function __construct() {
        $this->id             = 'mwe_order_shipped';
        $this->title          = __('Order Shipped', 'my-woo-extension');
        $this->description    = __('Sent when an order is marked as shipped', 'my-woo-extension');
        $this->heading        = __('Your order has shipped!', 'my-woo-extension');
        $this->subject        = __('Your {site_title} order #{order_number} has shipped', 'my-woo-extension');
        $this->template_base  = MWE_PLUGIN_DIR . 'templates/';
        $this->template_html  = 'emails/order-shipped.php';
        $this->template_plain = 'emails/plain/order-shipped.php';
        $this->customer_email = true;

        add_action('mwe_order_shipped_notification', [$this, 'trigger'], 10, 2);

        parent::__construct();
    }

    public function trigger(int $order_id, string $tracking_number): void {
        $this->object = wc_get_order($order_id);
        if (!$this->object) return;

        $this->recipient = $this->object->get_billing_email();
        $this->placeholders['{tracking_number}'] = $tracking_number;

        if ($this->is_enabled() && $this->get_recipient()) {
            $this->send(
                $this->get_recipient(),
                $this->get_subject(),
                $this->get_content(),
                $this->get_headers(),
                $this->get_attachments()
            );
        }
    }
}

// Register the email class
add_filter('woocommerce_email_classes', function (array $emails): array {
    $emails['MWE_Order_Shipped'] = new MWE_Custom_Email();
    return $emails;
});

HPOS-compatible order meta access

// Old way (post meta) — DEPRECATED
// $value = get_post_meta($order_id, '_custom_field', true);

// New way (HPOS compatible)
$order = wc_get_order($order_id);

// Read custom meta
$custom_value = $order->get_meta('_mwe_custom_field', true);

// Write custom meta
$order->update_meta_data('_mwe_custom_field', 'new_value');
$order->save();

// Query orders with custom meta (HPOS compatible)
$orders = wc_get_orders([
    'meta_query' => [
        [
            'key'   => '_mwe_custom_field',
            'value' => 'specific_value',
        ],
    ],
    'status' => 'completed',
    'limit'  => 50,
]);

Best Practices

  • Always declare HPOS compatibility — WooCommerce is migrating to custom order tables; use FeaturesUtil::declare_compatibility and avoid direct wp_posts queries for orders
  • Use WooCommerce CRUD methods — access order/product data via $order->get_total(), not get_post_meta(); CRUD methods work with both legacy and HPOS storage
  • Hook at the right priority — default priority is 10; use lower numbers (5) to run before WooCommerce's own handlers, higher (20+) to run after
  • Sanitize and escape everything — use sanitize_text_field() on input, esc_html() / esc_attr() on output; never trust $_POST or $_GET data
  • Use WooCommerce's built-in functions — wc_get_orders(), wc_get_products(), wc_price() handle edge cases and are forward-compatible
  • Namespace your meta keys — prefix all custom meta with your plugin slug (e.g., _mwe_) to avoid conflicts with other plugins
  • Support multisite — use is_plugin_active_for_network() checks if your plugin needs to work on WordPress multisite
  • Test with WooCommerce's test suite — use WC_Unit_Test_Case as a base class for PHPUnit tests

Common Pitfalls

ProblemSolution
Plugin breaks after WooCommerce updateHook into woocommerce_loaded instead of plugins_loaded to ensure WooCommerce classes are available
Order meta not saving with HPOS enabledUse $order->update_meta_data() and $order->save() instead of update_post_meta()
Hooks fire multiple times (duplicate emails, double stock reduction)Check if the hook has already been processed using a static flag or transient; use did_action() to check
Custom shipping method not appearingEnsure the method is registered via woocommerce_shipping_methods filter and the class extends WC_Shipping_Method
REST API endpoint returns 403Check permission_callback — use current_user_can('manage_woocommerce') for admin endpoints, or '__return_true' for public

Related Skills

  • @woocommerce-performance
  • @product-data-modeling
  • @discount-engine
  • @ecommerce-seo
  • @erp-integration

平台分布

Codex

37.01%
按下载量换算76

Claude

31.67%
按下载量换算65

Cursor

18.99%
按下载量换算39

Gemini CLI

9.26%
按下载量换算19

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills