| 开发者 | contlimbu |
|---|---|
| 更新时间 | 2026年9月25日 05:41 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[lhhw_banner] shortcode, with desktop and mobile images.[lhhw_notify].[lhhw_banner] shortcode where the banner should appear, for example on the home page. The same shortcode always displays the banner of whichever campaign is running.[lhhw_banner] displays the banner or slider. Attributes: countdown="overlay|below|none" and class="my-class".
[lhhw_countdown] displays the countdown on its own. Attributes: style="inline|boxes" and label="yes|no".
[lhhw_product_badge] places the product label manually, in an Elementor or theme template. Attribute: id="123".
[lhhw_notify] displays the "notify me" link or form. Attribute: mode="form|link".
They output nothing outside a happy hour.
Choose "Every day", "Days of the week" or "Days of the month", the first date and the time of each session, the duration (24 hours maximum) and an optional end date. Each session starts and ends on its own. When a chosen day does not exist in a month, the session takes place on the last day of that month. Campaign statistics show the totals and a breakdown per session.
Only one campaign applies at a time: the running one. When none is running, the next scheduled campaign is used for the "starts in" displays. If two schedules overlap, the campaign that started last applies during the overlap, and the campaign list says so. Archived campaigns never run.
When an order is placed, in classic or block checkout, each line sold at the happy hour price is tagged with the campaign, the price without the discount, the happy hour price and the discount, tax included. Statistics count paid orders (processing and completed) and deduct refunds. For orders placed before version 1.7, which carry no tag, the figures are estimated from the campaign categories and time slot, and are clearly flagged as estimates.
Prices switch at the exact second. Emptying the page cache relies on WP-Cron, which runs on site visits. On a low-traffic site, set up a real server cron calling wp-cron.php every minute.
Empty it when a session starts and ends, by hooking onto lhhw_happy_hour_start, lhhw_happy_hour_end or lhhw_purge_caches.
WooCommerce builds that list from the database, and happy hour prices are calculated on the fly. Use [products category="your-category"] instead.
The label is moved below the product title automatically when the theme hides the price. You can also choose "Below the title" for product lists, or place [lhhw_product_badge] in an Elementor or theme template.
During a campaign, the banner is shown on the pages of its categories. Outside campaigns, the pages of the categories ticked as dedicated show your message instead of products. The banner or the message is inserted with the standard WooCommerce hooks on classic themes, before the Product Collection block on block themes, and in JavaScript before the product grid for page builders.
In a table of your own database: e-mail, campaign name, context, page and date. They can be exported to CSV, deleted from the list, and are handled by the WordPress personal data export and erasure tools. The form is protected by a honeypot and a rate limit.
Use the lhhw_subscriber_added action (e-mail, data) to push new subscribers to your own tool, or import the CSV export.
Up to 767 px, Elementor's default mobile breakpoint. Change it with the lhhw_mobile_breakpoint filter.
The schedule, discount, categories, popup and banner saved in version 1.5 are converted into a first campaign automatically. If products were hidden outside the happy hour, the offer categories become the dedicated categories.
Filters: lhhw_is_active, lhhw_current_campaign, lhhw_product_in_scope, lhhw_happy_price, lhhw_link_url, lhhw_show_popup, lhhw_mobile_breakpoint, lhhw_title_selector, lhhw_category_mode, lhhw_subscribe_rate_limit, lhhw_csv_separator, lhhw_stats_order_statuses.
Actions: lhhw_happy_hour_start and lhhw_happy_hour_end (campaign ID as parameter), lhhw_purge_caches, lhhw_subscriber_added.
[lhhw_banner], [lhhw_countdown], [lhhw_product_badge], [lhhw_notify].[lhhw_banner], [lhhw_countdown], [lhhw_product_badge], [lhhw_notify].