LogoLogo
WooCommerce Extension 2.0
WooCommerce Extension 2.0
  • WooCommerce Extension 2.0 (BETA version)
  • Introduction
    • Features and requirements
    • What's new in version 2.0 (BETA version)
  • Install the extension
  • User guide
    • Mandatory WooCommerce settings
    • Configure Taxes
      • Display prices in the cart and checkout
      • Understand shopper Tax and Payments feature
    • Enable extension settings
    • Product Meta Fields module
      • Sync products to Digital River
    • Order checkout and post-checkout processes
      • Checkout an order
      • Fulfill an order
      • Cancel an order
      • Refund the order
  • Configure the extension
    • Configure general settings
    • Configure shipping zones
  • Support
    • Product Meta Fields module support
    • Settings module
    • Tax Calculation module
Powered by GitBook
On this page
  • Add a new field to the metabox
  • Product Meta Fields Methods
  • Field interface
  • Field classes
  1. Support

Product Meta Fields module support

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:

  1. Grab the Field array from the filter: add_filter( 'digitalriver.meta_fields', 'filter_method' )

  2. Pass the array as the first argument to filter_method().

  3. 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: MetaFieldsContainer $container

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 admin_enqueue_scripts hook

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: WC_Product $product

Return: void

Description: Saves the digitalriver meta values in metadata when a product is saved/created

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: PimpleContainer

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 $post_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

CountryOfOrigin

ECCN

HSCode

TaxCode

SkuGroupId

Description

ItemBreadcrumb

PreviousSupportNextSettings module

Last updated 5 months ago

The CountryOfOrigin field refers to the location where the product originated. The CountryOfOrigin is a two-letter Alpha-2 country code as described in the ISO 3166 international standard. Here is a list of .

Exports Control Classification Number (ECCN). A list of pre-approved ECCNs is found .

Read more about the Harmonized Commodity Description and Coding System (HS Code).

See a list of supported here.

Refer to for more information.

Provides a description of the .

A hierarchical classification system that organizes and categorizes your products. Refer to for more information.

country codes
here
here
tax codes
SKU group identifier
SKU group
Item breadcrumb