Skip to content

Hooks & Integration

Check the current call site before integrating. Payloads and lifecycle timing matter, especially when order retries or administrative updates can repeat an event.

Hook Arguments
woocommerce_competition_started Product ID
wc_competition_close Product ID
wc_competition_fail Array with competition_id and reason
wc_competition_min_fail Array with participants and product_id
wc_competition_won Product ID
woocommerce_competition_do_extend Product ID, new end date
woocommerce_competition_do_relist Product ID, new start date, new end date
wc_competition_after_log_participant Ticket numbers, product ID, user ID, order ID, entry results (log_ids), order item

Main draw notifications and instant prize notifications are different events.

During order processing, wc_competition_after_log_participant runs after the entry transaction commits. The callback receives per-entry success results in log_ids, not database row IDs. Do not use those values as primary keys.

wc_competition_participate and wc_competition_cancel_participation pass product ID, user ID, order ID, entry results, order item, item ID, and a cache-invalidated flag. The final flag lets the built-in cache handler avoid duplicate invalidation.

The extension and relisting actions run after their respective state updates. An extension retains the entry records; relisting can delete logs according to the selected option.

Hook Arguments
woocommerce_competition_participants Eligible participants, product ID, product object
woocommerce_competition_winners Selected winners, product ID, product object
competitions_for_woocommerce_product_default_ticket_quantity Default quantity, product object
woocommerce_competition_my_tickets_endpoint_post_ids_active Active product IDs
woocommerce_competition_my_tickets_endpoint_post_ids_past Past product IDs

Preserve the expected return shape when filtering participants or winners. Filtering a list is not a replacement for persisting orders, entries, or winner records through their normal processing paths.

The wallet integration uses woo_wallet(). Credit processing checks that this function exists and returns an object before calling woo_wallet()->wallet->credit(). Instant-win batches can combine eligible prize values into one credit. See Wallet Credits for store settings and checks.

Elementor Pro support loads on elementor_pro/init through competition_for_woocommerce_load_elementor_support. Custom product layouts must supply a valid competition product context to the widgets. See Widgets & Elementor Pro for template setup.

Competition_Extension registers widgets on elementor/widgets/register and conditions on elementor/theme/register_conditions. The integration requires Elementor 3.5.0 or later and the Elementor Pro WooCommerce widget classes.

Document type Condition Location
cfw-competitions-archive competition_archive archive
cfw-single-competition single_competition Product single location
cfw-draw-results cfw_draw_results single
cfw-entry-page cfw_entry_page cfw-entry-page

Page previews resolve the configured base, results, and entry page options. Single-competition previews require a competition product and fall back to a published competition when needed.

The dynamic widgets cfw-draw-results and cfw-entry-page-content reuse the native results renderer and entry templates. Keep entry routes separate from product purchase routes.

CFW_DNA_Payments_Compatibility registers only when DNACC_Plugin exists. The dnacc_product_competition_type filter returns true for a competition with _competition_instant_win set to yes. Otherwise, it preserves the existing verdict.

On woocommerce_before_order_item_object_save, the integration stores _dnacc_instant_win = yes on new qualifying product line items. It preserves existing flags and does not rewrite saved line items. This creation-time snapshot remains available for payment retries even if the product settings later change.

Use WooCommerce order CRUD for HPOS compatibility. Validate product type before using WC_Product_Competition methods. Make external side effects idempotent so retries do not duplicate fulfillment or credits.

Use Data & State to identify the records involved in entry processing.