# tier-pricing-table/7.1.4/src/Services/API/ProductFields/ProductField.php

Tiered Pricing Table for WooCommerce, version 7.1.4. 44 lines.

- Page: https://pluginprobe.com/plugins/tier-pricing-table/7.1.4/code/src/Services/API/ProductFields/ProductField.php
- Raw: https://pluginprobe.com/plugins/tier-pricing-table/7.1.4/raw/src/Services/API/ProductFields/ProductField.php
- Modified: 2024-08-19T12:44:10+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/tier-pricing-table/7.1.4/code/src/Services/API/ProductFields/ProductField.php#L10-L20`.

```php
<?php namespace TierPricingTable\Services\API\ProductFields;

use TierPricingTable\Core\ServiceContainerTrait;
use WC_Product;

abstract class ProductField {
	
	use ServiceContainerTrait;
	
	abstract public function getFieldSlug(): string;
	
	abstract public function getValue( array $product );
	
	abstract public function updateValue( $value, WC_Product $product );
	
	abstract public function getType();
	
	abstract public function getDescription();
	
	public function register() {
		register_rest_field( $this->getSupportedProductTypes(), $this->getFieldSlug(), array(
			'get_callback'    => array( $this, 'getValue' ),
			'update_callback' => array( $this, 'updateValue' ),
			'schema'          => array(
				'description' => $this->getDescription(),
				'type'        => $this->getType(),
				'context'     => $this->getContext(),
			),
		) );
	}
	
	public function getContext(): array {
		return array( 'view', 'edit' );
	}
	
	public function getSupportedProductTypes() {
		
		return apply_filters( 'tiered_pricing_table/api/supported_product_types', array(
			'product',
			'product_variation',
		), $this );
	}
}

```
