# Filters

### **tw**p&#x66;**\_global\_options**

Modify global options for the plugin. This filter allows you to customize the default settings used throughout the plugin.

```php
add_filter( 'twpf_global_options', 'twpf_custom_global_options' );
function twpf_custom_global_options( $options ) {
	// Modify global options
	$options['min_weight'] = 0.5;

	return $options;
}
```

### **tw**p&#x66;**\_menu\_capability**

Customize the capability required to access the menu. This filter allows you to control which user roles can access the `Packaging Fit` settings.

```php
add_filter( 'twpf_menu_capability', 'twpf_custom_menu_capability' );
function twpf_custom_menu_capability( $capability ) {
	return 'manage_woocommerce';
}
```

### **tw**p&#x66;**\_menu\_title**

Customize the menu title. Use this filter to change the text displayed in the WordPress admin menu.

```php
add_filter( 'twpf_menu_title', 'twpf_custom_menu_title' );
function twpf_custom_menu_title( $title ) {
	return __( 'Custom Packaging Fit Title', 'theme_name' );
}
```

### twpf\_prepare\_api\_request\_data

`@since 1.0.2`

Filters the data sent to the Packaging Fit API before making the request.

```php
add_filter( 'twpf_prepare_api_request_data', 'twpf_custom_prepare_api_request_data', 10, 2 );
function twpf_custom_prepare_api_request_data( $response_data, $order ) {
	// To capture debug information, use the code below.
	// If debugging is not needed, this code should be removed.
	ob_start();

	echo '<pre>';
	var_dump( $response_data );
	var_dump( $order->get_ID() );
	var_dump( $order->get_billing_postcode() );
	echo '</pre>';

	return array( 'debug' => ob_get_clean() );
	// End of debug information capture.

	// Change data here.



	return $response_data;
}
```


---

# 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://tigriweb.gitbook.io/packaging-fit/development/filters.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.
