Product Meta Fields module
Learn more about the Product Meta Fields module.
Digital River requires products to have certain fields that are not present in the WooCommerce product. Add these fields to the WC_Product
by using the concept of meta fields by using the ProductMetaFields
module.
Add a new field to the metabox
To add a new field to the metabox:
Grab the Field array from the filter:
add_filter( 'digitalriver.meta_fields', 'filter_method' )
Pass the array as the first argument to
filter_method()
.Add or remove fields from the array and then return it.
Product Meta Fields Methods
Product Meta Fields class
This class acts as the module's entry point.
Method | Args, Returns, and Descriptions |
name | Arg: - Return: string Description: Returns the name of the module |
__construct | Arg: Return: void Description: Constructs the object by passing in the dependencies |
init | Arg: - Return: void Description: Initializes the module, register necessary hooks, and defines the fields |
admin_enqueue_scripts | Arg: String $hook_suffix Return: void Description: Enqueue the scripts and stylesheets in the |
woocommerce_product_data_tabs | Arg: array $product_data_tabs Return: array Description: Add a new tab to enter the Digital River product details in the product create/edit page. |
woocommerce_product_data_panels | Arg: - Return: void Description: Renders HTML of Digital River tab under the WooCommerce Product Data metabox |
woocommerce_admin_process_product_object | Arg: Return: void Description: Saves the |
field | Arg: String $key Return: Field Description: Gets a field name as an argument and returns the field object |
Meta Fields Container class
This class acts as a Dependency Injection container for providing dependencies to classes present in the ProductMetaFields module.
Method | Args, Returns, and Descriptions |
__construct | Arg: Return: void Description: Accepts a Dependency Injection container as an argument and assigns it to a container attribute |
define_services | Arg: - Return: void Description: Defines all the classes present within the module |
Field interface
The interface must be implemented by all the meta fields.
Method | Args, Returns, and Descriptions |
meta_key | Arg: - Return: string Description: Returns the meta key |
render | Arg: - Return: void Description: Renders the meta field to the metabox |
value | Arg: int $post_id Return: mixed Description: Retrieves meta value of the post with id |
save | Arg: int $post_id, mixed $value Return: void Description: Saves the meta value to the post |
Field classes
This module has the following field classes:
Field class | Description |
| The |
| Exports Control Classification Number (ECCN). A list of pre-approved ECCNs is found here. |
| Read more here about the Harmonized Commodity Description and Coding System (HS Code). |
| See a list of supported tax codes here. |
Last updated