Filters

Packaging Fit provides several filter hooks that allow developers to extend and customize its functionality.

twpf_global_options

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

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;
}

twpf_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.

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

twpf_menu_title

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

twpf_prepare_api_request_data

@since 1.0.2

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

Last updated

Was this helpful?