Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问clear审计未展示

woocommercewoocommerce 搜索

Agent Skill

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

总安装

250

周安装

10

GitHub Stars

公开资料未说明

下载量

81
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/vapvarun/claude-backup --skill woocommerce

简介

woocommerce 用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。

  • 它适合围绕代码变更、仓库状态或协作事项进行整理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前建议确认权限范围和是否会触发文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

WooCommerce Development

E-commerce development with WooCommerce for WordPress.

Essential Hooks

Product Hooks

// Modify product price display
add_filter( 'woocommerce_get_price_html', function( $price_html, $product ) {
    if ( $product->is_on_sale() ) {
        $price_html .= '<span class="sale-badge">Sale!</span>';
    }
    return $price_html;
}, 10, 2 );

// Add custom field to product
add_action( 'woocommerce_product_options_general_product_data', function() {
    woocommerce_wp_text_input( array(
        'id'          => '_custom_field',
        'label'       => __( 'Custom Field', 'textdomain' ),
        'description' => __( 'Enter custom value', 'textdomain' ),
        'desc_tip'    => true,
    ) );
} );

// Save custom field
add_action( 'woocommerce_process_product_meta', function( $post_id ) {
    $value = isset( $_POST['_custom_field'] ) ? sanitize_text_field( $_POST['_custom_field'] ) : '';
    update_post_meta( $post_id, '_custom_field', $value );
} );

Cart Hooks

// Add fee to cart
add_action( 'woocommerce_cart_calculate_fees', function( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
        return;
    }

    $subtotal = $cart->get_subtotal();

    // Add handling fee for orders under $50
    if ( $subtotal < 50 ) {
        $cart->add_fee( __( 'Handling Fee', 'textdomain' ), 5.00 );
    }
} );

// Validate cart items
add_action( 'woocommerce_check_cart_items', function() {
    $cart = WC()->cart;

    foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
        $product = $cart_item['data'];

        // Check stock or custom validation
        if ( ! $product->is_in_stock() ) {
            wc_add_notice(
                sprintf( __( '%s is out of stock.', 'textdomain' ), $product->get_name() ),
                'error'
            );
        }
    }
} );

// Modify cart item data
add_filter( 'woocommerce_add_cart_item_data', function( $cart_item_data, $product_id, $variation_id ) {
    if ( isset( $_POST['custom_option'] ) ) {
        $cart_item_data['custom_option'] = sanitize_text_field( $_POST['custom_option'] );
    }
    return $cart_item_data;
}, 10, 3 );

Checkout Hooks

// Add custom checkout field
add_action( 'woocommerce_after_order_notes', function( $checkout ) {
    woocommerce_form_field( 'delivery_date', array(
        'type'        => 'date',
        'class'       => array( 'form-row-wide' ),
        'label'       => __( 'Preferred Delivery Date', 'textdomain' ),
        'required'    => true,
    ), $checkout->get_value( 'delivery_date' ) );
} );

// Validate custom field
add_action( 'woocommerce_checkout_process', function() {
    if ( empty( $_POST['delivery_date'] ) ) {
        wc_add_notice( __( 'Please select a delivery date.', 'textdomain' ), 'error' );
    }
} );

// Save custom field to order
add_action( 'woocommerce_checkout_update_order_meta', function( $order_id ) {
    if ( ! empty( $_POST['delivery_date'] ) ) {
        update_post_meta( $order_id, '_delivery_date', sanitize_text_field( $_POST['delivery_date'] ) );
    }
} );

Order Hooks

// After order is completed
add_action( 'woocommerce_order_status_completed', function( $order_id ) {
    $order = wc_get_order( $order_id );

    // Send to external system
    $data = array(
        'order_id'    => $order_id,
        'customer'    => $order->get_billing_email(),
        'total'       => $order->get_total(),
        'items'       => array(),
    );

    foreach ( $order->get_items() as $item ) {
        $data['items'][] = array(
            'product_id' => $item->get_product_id(),
            'quantity'   => $item->get_quantity(),
            'total'      => $item->get_total(),
        );
    }

    // Send to webhook
    wp_remote_post( 'https://api.example.com/orders', array(
        'body'    => wp_json_encode( $data ),
        'headers' => array( 'Content-Type' => 'application/json' ),
    ) );
} );

// Order status change
add_action( 'woocommerce_order_status_changed', function( $order_id, $old_status, $new_status, $order ) {
    // Custom notification logic
}, 10, 4 );

Custom Product Types

// Register custom product type
add_action( 'init', function() {
    class WC_Product_Subscription extends WC_Product {
        public function __construct( $product = 0 ) {
            $this->product_type = 'subscription';
            parent::__construct( $product );
        }

        public function get_type() {
            return 'subscription';
        }

        // Custom methods
        public function get_subscription_period() {
            return $this->get_meta( '_subscription_period' );
        }
    }
} );

// Add to product type selector
add_filter( 'product_type_selector', function( $types ) {
    $types['subscription'] = __( 'Subscription', 'textdomain' );
    return $types;
} );

// Show price fields
add_action( 'woocommerce_product_options_general_product_data', function() {
    global $product_object;

    if ( 'subscription' === $product_object->get_type() ) {
        woocommerce_wp_select( array(
            'id'      => '_subscription_period',
            'label'   => __( 'Billing Period', 'textdomain' ),
            'options' => array(
                'month' => __( 'Monthly', 'textdomain' ),
                'year'  => __( 'Yearly', 'textdomain' ),
            ),
        ) );
    }
} );

Payment Gateways

class WC_Gateway_Custom extends WC_Payment_Gateway {
    public function __construct() {
        $this->id                 = 'custom_gateway';
        $this->icon               = '';
        $this->has_fields         = true;
        $this->method_title       = __( 'Custom Gateway', 'textdomain' );
        $this->method_description = __( 'Custom payment gateway.', 'textdomain' );

        $this->supports = array(
            'products',
            'refunds',
        );

        $this->init_form_fields();
        $this->init_settings();

        $this->title       = $this->get_option( 'title' );
        $this->description = $this->get_option( 'description' );
        $this->enabled     = $this->get_option( 'enabled' );
        $this->api_key     = $this->get_option( 'api_key' );

        add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
    }

    public function init_form_fields() {
        $this->form_fields = array(
            'enabled' => array(
                'title'   => __( 'Enable/Disable', 'textdomain' ),
                'type'    => 'checkbox',
                'label'   => __( 'Enable Custom Gateway', 'textdomain' ),
                'default' => 'no',
            ),
            'api_key' => array(
                'title'       => __( 'API Key', 'textdomain' ),
                'type'        => 'password',
                'description' => __( 'Enter your API key', 'textdomain' ),
            ),
        );
    }

    public function process_payment( $order_id ) {
        $order = wc_get_order( $order_id );

        // Process payment with external API
        $response = wp_remote_post( 'https://api.payment.com/charge', array(
            'body' => array(
                'amount'   => $order->get_total(),
                'currency' => $order->get_currency(),
                'token'    => sanitize_text_field( $_POST['payment_token'] ),
            ),
            'headers' => array(
                'Authorization' => 'Bearer ' . $this->api_key,
            ),
        ) );

        $body = json_decode( wp_remote_retrieve_body( $response ), true );

        if ( isset( $body['success'] ) && $body['success'] ) {
            $order->payment_complete( $body['transaction_id'] );
            WC()->cart->empty_cart();

            return array(
                'result'   => 'success',
                'redirect' => $this->get_return_url( $order ),
            );
        } else {
            wc_add_notice( $body['error'] ?? __( 'Payment failed', 'textdomain' ), 'error' );
            return array( 'result' => 'fail' );
        }
    }

    public function process_refund( $order_id, $amount = null, $reason = '' ) {
        $order = wc_get_order( $order_id );

        $response = wp_remote_post( 'https://api.payment.com/refund', array(
            'body' => array(
                'transaction_id' => $order->get_transaction_id(),
                'amount'         => $amount,
            ),
        ) );

        $body = json_decode( wp_remote_retrieve_body( $response ), true );

        if ( isset( $body['success'] ) && $body['success'] ) {
            return true;
        }

        return new WP_Error( 'refund_failed', $body['error'] ?? 'Refund failed' );
    }
}

// Register gateway
add_filter( 'woocommerce_payment_gateways', function( $gateways ) {
    $gateways[] = 'WC_Gateway_Custom';
    return $gateways;
} );

REST API

Custom Endpoints

add_action( 'rest_api_init', function() {
    register_rest_route( 'custom/v1', '/products/featured', array(
        'methods'             => 'GET',
        'callback'            => 'get_featured_products',
        'permission_callback' => '__return_true',
    ) );
} );

function get_featured_products( WP_REST_Request $request ) {
    $args = array(
        'post_type'      => 'product',
        'posts_per_page' => $request->get_param( 'per_page' ) ?: 10,
        'tax_query'      => array(
            array(
                'taxonomy' => 'product_visibility',
                'field'    => 'name',
                'terms'    => 'featured',
            ),
        ),
    );

    $products = wc_get_products( $args );

    return array_map( function( $product ) {
        return array(
            'id'         => $product->get_id(),
            'name'       => $product->get_name(),
            'price'      => $product->get_price(),
            'image'      => wp_get_attachment_url( $product->get_image_id() ),
            'permalink'  => $product->get_permalink(),
        );
    }, $products );
}

Extend Existing Endpoints

// Add custom field to product API response
add_filter( 'woocommerce_rest_prepare_product_object', function( $response, $product, $request ) {
    $response->data['custom_field'] = $product->get_meta( '_custom_field' );
    $response->data['stock_status_label'] = $product->is_in_stock() ? 'Available' : 'Out of Stock';
    return $response;
}, 10, 3 );

// Allow updating custom field via API
add_action( 'woocommerce_rest_insert_product_object', function( $product, $request, $creating ) {
    if ( isset( $request['custom_field'] ) ) {
        $product->update_meta_data( '_custom_field', sanitize_text_field( $request['custom_field'] ) );
        $product->save();
    }
}, 10, 3 );

Performance

Query Optimization

// Disable unnecessary features
add_filter( 'woocommerce_background_image_regeneration', '__return_false' );
add_filter( 'woocommerce_enable_nocache_headers', '__return_false' );

// Limit product queries
add_filter( 'loop_shop_per_page', function() {
    return 24; // Products per page
} );

// Cache expensive queries
function get_best_sellers( $limit = 5 ) {
    $cache_key = 'wc_best_sellers_' . $limit;
    $products  = get_transient( $cache_key );

    if ( false === $products ) {
        global $wpdb;

        $products = $wpdb->get_results( $wpdb->prepare( "
            SELECT p.ID, p.post_title, SUM(oim.meta_value) as total_sales
            FROM {$wpdb->posts} p
            INNER JOIN {$wpdb->prefix}woocommerce_order_items oi ON p.ID = oi.order_item_name
            INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta oim ON oi.order_item_id = oim.order_item_id
            WHERE oim.meta_key = '_qty'
            AND p.post_type = 'product'
            AND p.post_status = 'publish'
            GROUP BY p.ID
            ORDER BY total_sales DESC
            LIMIT %d
        ", $limit ) );

        set_transient( $cache_key, $products, HOUR_IN_SECONDS );
    }

    return $products;
}

// Clear cache on order
add_action( 'woocommerce_order_status_completed', function() {
    delete_transient( 'wc_best_sellers_5' );
} );

AJAX Cart

// Update cart via AJAX
add_action( 'wp_ajax_update_cart_item', 'ajax_update_cart_item' );
add_action( 'wp_ajax_nopriv_update_cart_item', 'ajax_update_cart_item' );

function ajax_update_cart_item() {
    check_ajax_referer( 'wc_cart_nonce', 'nonce' );

    $cart_item_key = sanitize_text_field( $_POST['cart_item_key'] );
    $quantity      = absint( $_POST['quantity'] );

    if ( $quantity > 0 ) {
        WC()->cart->set_quantity( $cart_item_key, $quantity );
    } else {
        WC()->cart->remove_cart_item( $cart_item_key );
    }

    WC_AJAX::get_refreshed_fragments();
}

Email Customization

// Add content to order emails
add_action( 'woocommerce_email_order_details', function( $order, $sent_to_admin, $plain_text, $email ) {
    if ( 'customer_completed_order' === $email->id ) {
        echo '<h2>Thank you for your order!</h2>';
        echo '<p>Your order will be shipped within 2-3 business days.</p>';
    }
}, 5, 4 );

// Custom email
class WC_Email_Custom extends WC_Email {
    public function __construct() {
        $this->id             = 'custom_email';
        $this->title          = __( 'Custom Email', 'textdomain' );
        $this->description    = __( 'Custom email notification', 'textdomain' );
        $this->template_html  = 'emails/custom-email.php';
        $this->template_plain = 'emails/plain/custom-email.php';

        parent::__construct();
    }

    public function trigger( $order_id ) {
        if ( ! $order_id ) return;

        $this->object = wc_get_order( $order_id );
        $this->recipient = $this->object->get_billing_email();

        if ( ! $this->is_enabled() || ! $this->get_recipient() ) return;

        $this->send(
            $this->get_recipient(),
            $this->get_subject(),
            $this->get_content(),
            $this->get_headers(),
            $this->get_attachments()
        );
    }
}

add_filter( 'woocommerce_email_classes', function( $emails ) {
    $emails['WC_Email_Custom'] = new WC_Email_Custom();
    return $emails;
} );

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

32.46%
按下载量换算26

Antigravity

25.72%
按下载量换算21

Gemini CLI

17.97%
按下载量换算15

windsurf

11.36%
按下载量换算9

OpenCode

7.36%
按下载量换算6

Codex

3.58%
按下载量换算3

安全审计

暂无安全审计结果可展示。

权限和风险

敏感数据

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills