# Action Scheduler Handler

Apart from the default WordPress handler, the utilities package provides a CRON Events Handler for working with the famous Action Scheduler library of WooCommerce. You can read more about the library [here](https://actionscheduler.org/).

{% hint style="info" %}
This handler is not part of the WooCommerce Module simply because it's possible to use the Action Scheduler library *outside* of WooCommerce.
{% endhint %}

In order to work with it, you should register it with your CRON Events Service like this:

```php
<?php

use DeepWebSolutions\Framework\Utilities\CronEvents\CronEventsService;
use DeepWebSolutions\Framework\Utilities\CronEvents\Handlers\ActionSchedulerCronEventsHandler;

$as_handler = new ActionSchedulerCronEventsHandler( 'my-handler-id' );

// you can register the handler in the constructor...
$cron_service = new CronEventsService( $my_plugin, $my_logging_service, $my_hooks_service, array( $as_handler ) );
// ...or alternatively you can also do this
$cron_service->register_handler( $as_handler );

// now to use it ... if you set your handler's ID to 'default', you can skip the last argument
$cron_service->schedule_single_event( 'my-hook', null, array(), 'my-handler-id' );

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://framework.deep-web-solutions.com/utilities-module/cron-events-service/action-scheduler-handler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
