# merchant/2.2.7/admin/classes/admin-options/fields/custom-callback/class-merchant-field-custom-callback.php

Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together &amp; More for WooCommerce – Merchant, version 2.2.7. 45 lines.

- Page: https://pluginprobe.com/plugins/merchant/2.2.7/code/admin/classes/admin-options/fields/custom-callback/class-merchant-field-custom-callback.php
- Raw: https://pluginprobe.com/plugins/merchant/2.2.7/raw/admin/classes/admin-options/fields/custom-callback/class-merchant-field-custom-callback.php
- Modified: 2026-05-21T18:12:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/merchant/2.2.7/code/admin/classes/admin-options/fields/custom-callback/class-merchant-field-custom-callback.php#L10-L20`.

```php
<?php
/**
 * Merchant Field: Custom Callback
 *
 * @package Merchant
 * @since   2.2.5
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Merchant_Field_Custom_Callback
 *
 * Delegates rendering to a custom user-defined callback function.
 *
 * @since 2.2.5
 */
class Merchant_Field_Custom_Callback extends Merchant_Abstract_Field {

	/**
	 * Render the custom-callback field HTML output.
	 *
	 * @since 2.2.5
	 *
	 * @return void
	 */
	public function render() {
		$settings = $this->field;
		$value    = $this->value;

		if ( ! empty( $settings['class_name'] ) && ! empty( $settings['callback_name'] ) ) {
			/** @var callable $callback */
			$callback = array( $settings['class_name'], $settings['callback_name'] );
			call_user_func( $callback, $settings, $value );
			return;
		}

		if ( ! empty( $settings['callback_name'] ) ) {
			call_user_func( $settings['callback_name'], $settings, $value );
		}
	}
}

```
