MS Web Arts Rebranding Logo Icon
MS Web Arts Rebranding Logo
View Categories

Hooks: Actions

< 1 min read

All hooks are prefixed wcoffers_. Actions let you react to events:

ActionArgumentsFires when
wcoffers_offer_sent$offerA seller sends an offer to a customer.
wcoffers_offer_status_changed$offer, $from, $toAny offer status transition (send, accept, purchase, cancel, expire…). Statuses are the wco-* keys from Statuses & Lifecycle.
wcoffers_request_created$requestA customer submits a request.
wcoffers_request_viewed$requestThe seller opens a request for the first time.
wcoffers_request_rejected$requestThe seller rejects a request.
wcoffers_before_boot / wcoffers_booted$pluginAround plugin service registration, for advanced integrations.

Example: ping a webhook whenever an offer is purchased

add_action( 'wcoffers_offer_status_changed', function ( $offer, $from, $to ) {
	if ( 'wco-purchased' === $to ) {
		wp_remote_post( 'https://example.com/webhook', array(
			'body' => array( 'offer_id' => $offer->get_id() ),
		) );
	}
}, 10, 3 );
Go to Top