WXP Local Events for WooCommerce offers two filters and one action. All names start with wxp_local_events_woocommerce_. The hooks of WXP Local Events itself are in Filter- and action hooks.
Overview #
| Hook | Type | What it does |
|---|---|---|
wxp_local_events_woocommerce_hold_minutes |
Filter | Changes how long a reservation holds its seats while it waits for the payment. |
wxp_local_events_woocommerce_open_coupon |
Filter | Decides whether the coupon panel of the cart and block checkout is opened by default for a cart with tickets. |
wxp_local_events_woocommerce_noindex |
Action | Fires when a ticket product is marked noindex, so other code can do the same for more SEO plugins. |
How to use a hook #
A filter receives a value, can change it and must return it. An action tells you that something happened, and returns nothing. Add your code to the functions.php of your child theme, or to a small plugin of your own.
wxp_local_events_woocommerce_hold_minutes #
Filter. By default the time is the setting Hold stock (minutes) of WooCommerce, or 60 minutes when that is empty. The result is never lower than 5 minutes.
| Argument | Type | Description |
|---|---|---|
$minutes |
int | Minutes. |
Return: the number of minutes.
add_filter( 'wxp_local_events_woocommerce_hold_minutes', function ( $minutes ) {
return 30; // Hold seats for half an hour.
} );
wxp_local_events_woocommerce_open_coupon #
Filter. The coupon field (“Add coupons”) of the block checkout and the cart is opened by default for a cart with tickets, when coupons are enabled in WooCommerce. Return false to keep it closed.
| Argument | Type | Description |
|---|---|---|
$open |
bool | true by default. |
Return: true or false.
add_filter( 'wxp_local_events_woocommerce_open_coupon', '__return_false' );
wxp_local_events_woocommerce_noindex #
Action. The ticket product of an event is kept out of the search results. For Rank Math the add-on sets the robots meta itself. For other SEO plugins, use this action to set noindex on the product.
| Argument | Type | Description |
|---|---|---|
$product_id |
int | The id of the ticket product. |
Good to know #
- Product type: the hidden product has the type
event_ticket. There is one product per event; the date of the occurrence travels with the cart line. - Expiry job: unpaid reservations are released by a job on the schedule
wxp_le_woo_quarter_hour(every 15 minutes), hookwxp_local_events_woocommerce_expire. - SEO: Yoast SEO and All in One SEO support for noindex follows later; until then use the action above.