Token导航 LogoToken导航

Agent Skill · 开发

woocommerce-subscriptions(woocommerce 订阅)

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

woocommerce-subscriptions 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描有提醒项,按安装量在开发类的 21,746 个 Skill 里排第 17,229。

总安装 428周安装 18GitHub Stars 19下载 150核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

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

通过 npx skills add 命令从 finsilabs/awesome-ecommerce-skills 仓库安装,路径为 skills/woocommerce-subscriptions。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。当前分类为开发,与其功能一致,归类合理。

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

上手步骤

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-subscriptions 怎么安装?

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

woocommerce-subscriptions 支持哪些 AI 工具?

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

woocommerce-subscriptions 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

woocommerce-subscriptions 是免费的吗?

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

woocommerce-subscriptions 用的人多吗?

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

woocommerce-subscriptions 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

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

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
woocommerce-subscriptions

woocommerce 订阅 · 本页

42819只读未明确有提醒

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

SKILL.md 原文

WooCommerce Subscriptions

Overview

WooCommerce Subscriptions (the official premium plugin) adds subscription product types — simple subscriptions and variable subscriptions — with configurable billing periods (daily, weekly, monthly, yearly), free trials, sign-up fees, and prorated upgrades/downgrades. It integrates with Stripe, PayPal Reference Transactions, and other gateways that support automated recurring billing. Custom logic hooks into the subscription lifecycle via a rich set of WordPress actions and filters.

When to Use This Skill

  • When selling products or services on a recurring billing schedule (SaaS, memberships, box subscriptions)
  • When implementing subscription upgrades, downgrades, or plan switching
  • When building custom renewal logic or adding business rules around failed payment retry
  • When integrating subscription status with access control (e.g., membership site content gates)
  • When extending subscription emails or admin reporting with custom data
  • When creating subscription add-ons or per-unit quantity scaling

Core Instructions

  1. Create a subscription product programmatically <?php // Create a simple subscription product via code (e.g., in a migration script) $product = new WC_Product_Subscription(); $product->set_name('Monthly Pro Plan'); $product->set_status('publish'); $product->set_regular_price('29.99'); // Save first so the product gets an ID $product->save(); // Subscription-specific meta (product must be saved before setting post meta) update_post_meta($product->get_id(), '_subscription_price', '29.99'); update_post_meta($product->get_id(), '_subscription_period', 'month'); update_post_meta($product->get_id(), '_subscription_period_interval', '1'); update_post_meta($product->get_id(), '_subscription_length', '0'); // 0 = forever update_post_meta($product->get_id(), '_subscription_trial_length', '14'); update_post_meta($product->get_id(), '_subscription_trial_period', 'day'); update_post_meta($product->get_id(), '_subscription_sign_up_fee', '0');
  2. Hook into subscription lifecycle events WooCommerce Subscriptions fires specific actions at each lifecycle stage: <?php // When a new subscription is created (after successful first payment) add_action('woocommerce_subscription_status_active', function ($subscription) {$user_id = $subscription->get_user_id(); $plan = $subscription->get_items(); // Array of WC_Order_Item_Product // Grant access — e.g., set user role or update capabilities $user = new WP_User($user_id); $user->add_role('subscriber_member'); // Track in analytics error_log("Subscription {$subscription->get_id()} activated for user {$user_id}");}); // When a renewal payment succeeds add_action('woocommerce_subscription_renewal_payment_complete', function ($subscription, $last_order) {$user_id = $subscription->get_user_id(); // Extend access, send renewal receipt, update CRM do_action('my_plugin_renewal_processed', $user_id, $subscription);}, 10, 2); // When a renewal payment fails add_action('woocommerce_subscription_payment_failed', function ($subscription, $last_order) {$user_id = $subscription->get_user_id(); $retry_count = $subscription->get_failed_payment_count(); // Notify user and optionally pause access if ($retry_count >= 2) {$user = new WP_User($user_id); $user->remove_role('subscriber_member'); // Send dunning email $subscription->update_status('on-hold');}}, 10, 2); // When subscription is cancelled add_action('woocommerce_subscription_status_cancelled', function ($subscription) {$user_id = $subscription->get_user_id(); $user = new WP_User($user_id); $user->remove_role('subscriber_member');});
  3. Query subscriptions programmatically <?php // Get all active subscriptions for a user function get_user_active_subscriptions(int $user_id): array {return wcs_get_users_subscriptions($user_id, ['active']);} // Check if a user has an active subscription to a specific product function user_has_active_subscription_to_product(int $user_id, int $product_id): bool {$subscriptions = wcs_get_subscriptions_for_product($product_id, 'any', ['customer_id' => $user_id]); foreach ($subscriptions as $subscription) {if ($subscription->has_status('active')) {return true;}} return false;} // Get subscription by ID function get_subscription_details(int $subscription_id):?WC_Subscription {$subscription = wcs_get_subscription($subscription_id); if (!$subscription) return null; return $subscription;} // Usage $subscription = get_subscription_details(1234); if ($subscription) {echo $subscription->get_status(); // 'active', 'on-hold', 'cancelled', etc. echo $subscription->get_next_payment_date(); // ISO 8601 date echo $subscription->get_total(); // Current billing amount}
  4. Handle plan upgrades and downgrades <?php // Add proration logic for plan switches add_filter('woocommerce_subscriptions_switch_proration', function ($proration_amount, $subscription, $new_order, $product, $switch_cart_item) {// Custom proration: charge/credit based on days remaining in billing period $next_payment = strtotime($subscription->get_next_payment_date()); $last_payment = $subscription->get_date('last_payment'); $billing_period_days = ($next_payment - strtotime($last_payment)) / DAY_IN_SECONDS; $days_remaining = ($next_payment - time()) / DAY_IN_SECONDS; $old_daily_rate = (float)$subscription->get_total() / $billing_period_days; $new_product_price = (float)$switch_cart_item['data']->get_price(); $new_daily_rate = $new_product_price / $billing_period_days; // Credit remaining days at old rate, charge at new rate $proration_amount = ($new_daily_rate - $old_daily_rate) * $days_remaining; return round($proration_amount, 2);}, 10, 5); // Trigger a plan switch programmatically function switch_subscription_plan(int $subscription_id, int $new_product_id): bool {$subscription = wcs_get_subscription($subscription_id); if (!$subscription) return false; // Remove existing item and add new product foreach ($subscription->get_items() as $item_id => $item) {$subscription->remove_item($item_id);} $item = new WC_Order_Item_Product(); $item->set_product(wc_get_product($new_product_id)); $item->set_quantity(1); $subscription->add_item($item); // Recalculate totals $subscription->calculate_totals(); $subscription->save(); return true;}
  5. Retry failed payments and synchronize billing dates <?php // Trigger an immediate payment retry (e.g., from an admin action) function retry_failed_subscription_payment(int $subscription_id): bool {$subscription = wcs_get_subscription($subscription_id); if (!$subscription ||!$subscription->has_status('on-hold')) {return false;} // Create a renewal order and attempt payment $renewal_order = wcs_create_renewal_order($subscription); if (is_wp_error($renewal_order)) {return false;} // Process payment using the subscription's payment method $payment_gateway = wc_get_payment_gateway_by_order($subscription); if ($payment_gateway && method_exists($payment_gateway, 'scheduled_subscription_payment')) {$payment_gateway->scheduled_subscription_payment($renewal_order->get_total(), $renewal_order);} return true;} // Synchronize all active subscriptions to renew on the 1st of the month add_filter('woocommerce_subscriptions_synced_next_payment_date', function ($next_payment_date, $product, $from_timestamp, $trial_end_timestamp) {if ($product->get_meta('_subscription_period') === 'month') {$next_month = date('Y-m-01', strtotime('+1 month')); return strtotime($next_month);} return $next_payment_date;}, 10, 4);

Examples

Suspension and reinstatement flow

<?php

// Admin-triggered suspension with reason logging
function suspend_subscription_with_reason(int $subscription_id, string $reason): void {
    $subscription = wcs_get_subscription($subscription_id);
    if (!$subscription) return;

    // Store suspension reason as meta before status change
    $subscription->update_meta_data('_suspension_reason', $reason);
    $subscription->update_meta_data('_suspension_date', current_time('mysql'));
    $subscription->save();

    // Change status to on-hold (fires woocommerce_subscription_status_on-hold action)
    $subscription->update_status('on-hold', sprintf('Suspended: %s', $reason));
}

// Reinstate and reset payment date
function reinstate_subscription(int $subscription_id): void {
    $subscription = wcs_get_subscription($subscription_id);
    if (!$subscription || !$subscription->has_status('on-hold')) return;

    // Reset next payment date to avoid immediately triggering a renewal
    $subscription->set_date('next_payment', strtotime('+1 month'));

    // Activate subscription
    $subscription->update_status('active', 'Reinstated by admin');
    $subscription->save();
}

Custom subscription email

<?php

// Add a custom "Renewal Reminder" email 7 days before renewal
add_filter('woocommerce_email_classes', function ($email_classes) {
    require_once plugin_dir_path(__FILE__) . 'class-renewal-reminder-email.php';
    $email_classes['My_Renewal_Reminder_Email'] = new My_Renewal_Reminder_Email();
    return $email_classes;
});

// Schedule the emails via WooCommerce action scheduler
add_action('woocommerce_scheduled_subscription_payment', function ($subscription_id) {
    $subscription = wcs_get_subscription($subscription_id);
    if (!$subscription) return;

    // Schedule reminder 7 days before next payment
    $next_payment = strtotime($subscription->get_next_payment_date()) - (7 * DAY_IN_SECONDS);
    if ($next_payment > time()) {
        as_schedule_single_action(
            $next_payment,
            'my_plugin_send_renewal_reminder',
            [['subscription_id' => $subscription_id]]
        );
    }
}, 10);

Best Practices

  • Use Action Scheduler (bundled with WooCommerce) for all async subscription tasks — never rely on WP cron for payment-critical operations
  • Always use wcs_get_subscription() with null-checks — subscriptions may be deleted or missing in edge cases (manual deletions, import failures)
  • Test payment gateway token handling — subscription renewals require a stored payment token; test that the gateway correctly charges the original card on file during renewal
  • Handle failed payment dunning explicitly — the default retry schedule is 1, 4, and 7 days after failure; customize via wcs_retry_rules filter to match your business policy
  • Log all subscription status changes — store status change history in order notes or a custom table for auditing and customer support
  • Respect proration on plan switches — don't force customers to pay double for the same period; use built-in proration or implement custom logic
  • Test upgrade/downgrade edge cases — especially when a trial is active or when the billing period changes (monthly to annual)
  • Use wcs_user_has_subscription() for access control — it's more reliable than checking user roles alone

Common Pitfalls

ProblemSolution
Renewal payments not processingCheck that the payment gateway has supports[] = subscription in its capabilities; gateways must explicitly declare subscription support
Subscription status stays "pending" after successful paymentThe woocommerce_payment_complete action must fire — verify the payment gateway calls $order->payment_complete() on success
Proration results in negative chargeImplement minimum floor of 0.00 in the proration filter return value; negative amounts cause gateway errors on most processors
wcs_get_subscriptions_for_product returns emptyPass the product's parent ID for variations — WCS stores the parent product ID, not the variation ID, on subscription items
Trial ends but renewal isn't chargedEnsure _subscription_trial_length meta is set to a number > 0 AND the payment gateway token is stored correctly from the initial order
Cancellation emails sent on admin status changesAdd remove_action for woocommerce_subscription_status_cancelled before programmatic cancellations and re-add after if you need to suppress emails

Related Skills

  • @woocommerce-plugin-development
  • @woocommerce-rest-api
  • @subscription-billing
  • @stripe-integration
  • @woocommerce-blocks

平台分布

Codex

34.48%
按下载量换算52

Claude

29.72%
按下载量换算45

Cursor

18.34%
按下载量换算28

Gemini CLI

9.59%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

继续浏览同类 Skills