# Hooks - Wholesaleline 1.x documentation

> The actions and filters Wholesaleline offers to developers, with their arguments.

Wholesaleline's actions and filters, for code in a theme's `functions.php` or a small plugin. `WHOLESALELINE_VERSION`, `WHOLESALELINE_FILE`, `WHOLESALELINE_URL` and `WHOLESALELINE_DIR` are available once it has loaded.

## Actions

| Action | Arguments | When |
|---|---|---|
| `wholesaleline_loaded` | none | Once Wholesaleline has loaded (on `plugins_loaded`, with WooCommerce active). |
| `wholesaleline_settings` | `string $page` (`wholesaleline`) | Wholesaleline's settings sections and fields have been added: add your own sections and fields to the `wholesaleline` page, and register their options in the `wholesaleline` group. |
| `wholesaleline_application_submitted` | `int $user_id`, `array $answers` (field key => answer) | A customer submits a wholesale application, before any automatic approval. |
| `wholesaleline_application_approved` | `int $user_id`, `string $group` (group key) | An application is approved; the customer is now in the group. |
| `wholesaleline_application_declined` | `int $user_id`, `string $reason` (may be empty) | An application is declined. |
| `wholesaleline_group_saved` | `string $key` (group key), `array $group` (its settings) | A customer group is saved, new or edited. |
| `wholesaleline_group_changed` | `int $user_id`, `string $key` (new group, `''` for none), `string $before` (old group, `''` for none) | A customer joins, changes or leaves a group: from their profile, the Users bulk actions, an approval or a deleted group. |
| `wholesaleline_payment_recorded` | `WC_Order $order` | A payment on account is recorded for an order (the **Record payment on account** order action). |

## Filters

| Filter | Value and arguments | What it decides |
|---|---|---|
| `wholesaleline_price` | `float\|null $price`, `WC_Product $product`, `int $user_id`, `array\|null $rule` (`kind`, `amount`, `source`: `customer` or `group`) | A customer's price for a product from the price lists. `null`: the regular price. Discountline's discounts and tiers apply on top. |
| `wholesaleline_quantity_rule` | `array $rule` (`min`, `max`, `step`; 0 for none), `WC_Product $product`, `int $user_id` | A customer's quantity rule for a product, used by the quantity box, the shop's Add to cart buttons, add to cart, the cart check and the Store API's quantity limits. |
| `wholesaleline_min_order` | `float $min` (0 for none), `int $user_id` | A customer's minimum order value (the cart subtotal as shown), checked in the classic cart and checkout and the Cart and Checkout blocks. |
| `wholesaleline_prices_hidden` | `bool $hidden`, `WC_Product\|null $product` (`null`: prices in general), `string $audience` (`guest`, `retail`, a group key, or `''` for shop managers) | Whether prices are hidden from the current shopper. |
| `wholesaleline_hidden_price_html` | `string $html`, `WC_Product $product`, `string $audience` | What shows instead of a hidden price, for example a "Request a quote" button. |
| `wholesaleline_tax_exempt` | `bool $exempt`, `int $user_id` | Whether a customer is exempt from tax (their own setting, else their group's). |
| `wholesaleline_terms_available` | `bool $available` (default: logged in, with payment terms), `int $user_id` | Whether a customer may pay on account. |
| `wholesaleline_terms_order_status` | `string $status` (default `processing`), `WC_Order $order` | The status of an order placed on account. Not applied to an order held for going over the balance limit (it goes on hold). |
| `wholesaleline_balance_statuses` | `string[] $statuses` (without `wc-`; default: WooCommerce's paid statuses plus `on-hold`) | The order statuses whose unpaid "Pay on account" orders count toward a customer's account balance. |

## Examples

A "Request a quote" link instead of hidden prices:

```php
add_filter( 'wholesaleline_hidden_price_html', function ( $html, $product ) {
	return '<a class="button" href="/quote/?product=' . absint( $product->get_id() ) . '">Request a quote</a>';
}, 10, 2 );
```

Orders on account wait in **On hold** until you check them:

```php
add_filter( 'wholesaleline_terms_order_status', function () {
	return 'on-hold';
} );
```

Source: https://extendiment.com/plugins/wholesaleline/docs/1.x/hooks
