| 开发者 | cnwebstyle |
|---|---|
| 更新时间 | 2026年11月10日 05:54 |
| PHP版本: | 8.0 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
$code = apply_filters( 'cnwscoupons_issue_code', '', array( 'campaign' => 'spring-offer', 'email' => 'customer@example.com', 'source' => 'my-plugin' ) );
The filter returns an empty string when the campaign does not exist, has ended, has issued all its codes, has a shared code, or the e-mail address is invalid.
List active campaigns with personal codes (slug => name):
$campaigns = apply_filters( 'cnwscoupons_active_campaigns', array() );
List active campaigns with one shared code (slug => name and code):
$shared = apply_filters( 'cnwscoupons_shared_campaigns', array() );
Add-ons can change the WooCommerce coupon a code produces with the cnwscoupons_coupon_data filter, store their own settings on a campaign (cnwscoupons_extension_sanitizers), add fields to the campaign guide with the JavaScript filter cnwscoupons.guide.shipping, and look up a code's campaign with cnwscoupons_campaign_for_code.
WP-CLI: wp webstyle-coupons create-campaign, list-campaigns, issue and codes.
No. They are served to WooCommerce on the fly from the plugin's own tables, so they do not appear in WooCommerce's coupon list. The plugin shows them per campaign instead.
The code is released and can be used again until it expires.
No. Everything stays in your shop's database, and the admin screen loads no external scripts or fonts.
The e-mail address of each recipient of a personal code, and for each use the order number, e-mail address, country, discount and order total. The codes and uses of an e-mail address can be exported and erased with WordPress' own tools under Tools → Export Personal Data and Erase Personal Data, and the plugin adds a suggested text to your privacy policy.
Campaigns, codes and their history are kept, so you do not lose your figures by mistake. To remove them when the plugin is deleted, set the option cnwscoupons_delete_data_on_uninstall to yes first, for example with wp option update cnwscoupons_delete_data_on_uninstall yes.
The free plugin never changes shipping: the discount is taken off the products, and the guide shows how WooCommerce calculates shipping in your shop when the code is used. Free shipping with a code, a discount on shipping and a free-shipping threshold measured before the discount come with Checkout Optimizer Pro, which adds these settings to the campaign guide.
cnwscoupons_shared_campaigns lists active campaigns with one shared code and the code, so a newsletter plugin can offer them next to personal codes.