WP Manifestindependent plugin directory
manifest / ecommerce / woocommerce-public-coupon-stats

WooCommerce Public Coupon Stats

Create tokenized public WooCommerce coupon statistics pages with usage limits, restrictions, caching, and privacy-safe sharing.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/amirrezashf/woocommerce-public-coupon-stats/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Create tokenized public statistics pages for selected WooCommerce coupons.

Features

  • Per-coupon public statistics toggle
  • Random 12-character public token
  • Copy and regenerate URL controls in the coupon editor
  • Public card-based statistics page
  • Coupon status, usage limits, discount settings, product and category restrictions
  • Usage progress indicator when a global usage limit exists
  • 3-hour HTML transient cache
  • Automatic rewrite-rule setup on plugin activation
  • Legacy metadata fallback for _fa_public_stats_enabled and _fa_public_stats_token
  • Noindex/nofollow headers on public statistics pages
  • Email restriction values are not exposed publicly; only the number of configured restrictions is shown

Requirements

  • WordPress 6.0+
  • PHP 7.4+
  • WooCommerce

Installation

  1. Upload the plugin folder to /wp-content/plugins/.
  2. Activate WooCommerce Public Coupon Stats.
  3. Edit a WooCommerce coupon.
  4. Enable public coupon statistics and save the coupon.
  5. Copy the generated URL.

The plugin flushes rewrite rules on activation, so manually saving permalinks is normally unnecessary.

How It Works

Each enabled coupon receives a random public token and becomes available at:

/coupon-stats/{token}/

Regenerating the token invalidates the previous URL. Generated HTML is cached for three hours.

Data Storage

Coupon meta:

  • _wcpcs_public_stats_enabled
  • _wcpcs_public_stats_token

Legacy keys are read for backward compatibility:

  • _fa_public_stats_enabled
  • _fa_public_stats_token

Transient:

  • wcpcs_coupon_stats_html_{token}

Security and Privacy

The token makes the URL difficult to guess but is not authentication. Anyone with the URL can access the public statistics page.

Email restriction addresses are not exposed. Only the number of configured email restrictions is displayed.

Public pages include noindex, nofollow, and noarchive directives.

Compatibility

Coupon data is read through WooCommerce WC_Coupon. The feature does not depend on WooCommerce order storage, so HPOS does not affect its coupon metadata behavior.

License

GPL-3.0

Author

Amirreza Shayesteh Far
https://github.com/amirrezashf


آمار عمومی کد تخفیف ووکامرس

این افزونه برای کدهای تخفیف منتخب WooCommerce یک صفحه عمومی آماری با URL تصادفی ایجاد می‌کند.

قابلیت‌ها

  • فعال یا غیرفعال کردن صفحه عمومی برای هر کد تخفیف
  • توکن تصادفی ۱۲ کاراکتری
  • دکمه کپی و بازتولید URL در صفحه ویرایش کد تخفیف
  • صفحه عمومی کارت‌محور
  • نمایش وضعیت، تعداد استفاده، محدودیت‌ها، نوع تخفیف و محدودیت‌های محصول و دسته
  • نوار پیشرفت در صورت وجود سقف استفاده کلی
  • کش HTML به مدت ۳ ساعت
  • ثبت و Flush خودکار Rewrite Rule هنگام فعال‌سازی افزونه
  • سازگاری با Meta Keyهای نسخه قدیمی
  • جلوگیری از ایندکس شدن صفحه عمومی
  • عدم نمایش عمومی آدرس‌های ایمیل محدودشده

نیازمندی‌ها

  • WordPress 6.0+
  • PHP 7.4+
  • WooCommerce

نصب

  1. پوشه افزونه را در /wp-content/plugins/ قرار دهید.
  2. افزونه WooCommerce Public Coupon Stats را فعال کنید.
  3. یک کد تخفیف WooCommerce را ویرایش کنید.
  4. گزینه نمایش عمومی آمار را فعال و ذخیره کنید.
  5. URL ایجادشده را کپی کنید.

در حالت عادی نیازی به ذخیره دستی Permalinkها نیست.

نحوه عملکرد

برای هر کد تخفیف فعال‌شده یک Token تصادفی ساخته می‌شود و صفحه آماری از مسیر زیر قابل مشاهده است:

/coupon-stats/{token}/

بازتولید Token باعث نامعتبر شدن URL قبلی می‌شود. HTML صفحه برای ۳ ساعت Cache می‌شود.

ذخیره‌سازی داده

Metaهای جدید:

  • _wcpcs_public_stats_enabled
  • _wcpcs_public_stats_token

برای سازگاری با نسخه قدیمی، این کلیدها نیز خوانده می‌شوند:

  • _fa_public_stats_enabled
  • _fa_public_stats_token

Transient:

  • wcpcs_coupon_stats_html_{token}

امنیت و حریم خصوصی

Token تصادفی فقط URL را غیرقابل حدس‌تر می‌کند و جایگزین Authentication نیست. هر فردی که URL را داشته باشد می‌تواند صفحه آمار را مشاهده کند.

آدرس‌های ایمیل موجود در Email Restrictions به‌صورت عمومی نمایش داده نمی‌شوند و فقط تعداد محدودیت‌ها نشان داده می‌شود.

صفحات عمومی دارای noindex، nofollow و noarchive هستند.

سازگاری

داده‌های Coupon از طریق WC_Coupon خوانده می‌شوند و این قابلیت وابستگی مستقیمی به Storage سفارش‌ها ندارد؛ بنابراین HPOS روی این بخش اثری ندارد.

مجوز

GPL-3.0

نویسنده

Amirreza Shayesteh Far
https://github.com/amirrezashf