Tax Helper Functions

The helper you can use to create, delete, get and update Tax details.

function add_tax($tax) {.....}

Supported hooks

Filter name: before_add_tax Description: This filter would be executed before add tax into the database in add_tax helper. Usage:

// The filter callback function is based on the filter.

add_filter( ‘before_add_tax’, ‘before_add_tax_callback_fun’, 10, 1 );

function before_add_tax_callback_fun($tax) {
 // code
}

Filter name: should_add_tax Description: This filter would be executed before add tax into database in add_tax helper. Usage:

// The filter callback function is based on the filter.

add_filter( ‘should_add_tax’, ‘should_add_tax_callback_fun’, 10, 1 );

function should_add_tax_callback_fun($tax) {
    // code
}

hook name: pre.add.tax Description: This hook would be executed before add tax into the database in add_tax helper. Usage:

hook name: post.add.tax Description: This hook would be executed after add tax into the database in add_tax helper. Usage:

Usage

Request Parameters

Parameters in array format includes following attributes:

Param
Type
Required
Default
Description

tax_type

Character

Yes

Null

The tax_type of specific tax.

tax_rate

Decimal Integer

0

the tax_rate for specific tax.

is_percentage

Integer

Yes

1

The is_percentage is conformed tax in percentage or not for specific tax.

is_brackets_active

Integer

Yes

Null

The is_brackets_active if active then create price bracket data for specific tax.

is_tax_inclusive

Integer

0

The is_tax_inclusive for specific tax.

start_range

Integer

Null

The start_range for specific tax price_bracket.

end_range

Integer

Null

The end_range for specific tax price_bracket.

tax_rate_price_bracket

Integer

0

The tax_rate for specific tax price_bracket.

is_percentage_price_bracket

Integer

1

The is_percentage for specific tax price_bracket.

company_id

Integer

Yes

Null

The company_id for specific tax.

Response

function get_tax($tax_type_id) {....}

Supported hooks

Filter name: before_get_tax Description: This filter would be executed before retrieving tax details from database in get_tax helper. Usage:

Filter name: should_get_tax Description: This filter would be executed before retrieving tax details from database in get_tax helper. Usage:

hook name: pre.get.tax Description: This hook would be executed before retrieving tax details from database in get_tax helper. Usage:

hook name: post.get.tax Description: This hook would be executed after retrieving tax details from database in get_tax helper. Usage:

Usage

Request Parameters

Param
Type
Required
Default
Description

$tax_type_id

Integer

Yes

Null

The id of the tax corresponds to the tax_type table

Response

function get_taxes($filter) {.....}

Supported hooks

Filter name: before_get_taxes Description: This filter would be executed before retrieving tax details from database in get_taxes helper. Usage:

Filter name: should_get_taxes Description: This filter would be executed before retrieving tax details from database in get_taxes helper. Usage:

hook name: pre.get.taxes Description: This hook would be executed before retrieving tax details from database in get_taxes helper. Usage:

hook name: post.get.taxes Description: This hook would be executed after retrieving tax details from database in get_taxes helper. Usage:

Usage

Request Parameters

parameter array filter required for tax details.

Param
Type
Required
Default
Description

tax_type

Character

Yes

Null

The tax type for a specific tax table.

company_id

Integer

Yes

Null

The company_id for specific tax.

tax_type_id

Integer

yes

Null

The tax_type_id primary key of tax type table for specific tax.

Response

function update_tax($tax, $tax_type_id) {....}

Usage

Supported hooks

Filter name: before_update_tax Description: This filter would be executed before update tax into the database in update_tax helper. Usage:

Filter name: should_update_tax Description: This filter would be executed before update tax into database in update_tax helper. Usage:

hook name: pre.update.tax Description: This hook would be executed before update tax into the database in update_tax helper. Usage:

hook name: post.update.tax Description: This hook would be executed after update tax into the database in update_tax helper. Usage:

Request Parameters

Request required tax_type_id and array format data includes following attributes:

Param
Type
Required
Default
Description

tax_type_id

Integer

Yes

Null

The tax type id primary key or tax_type table.

tax_type

Character

Yes

Null

The tax_type of specific tax.

tax_rate

Decimal Integer

0

the tax_rate for specific tax.

is_percentage

Integer

Yes

1

The is_percentage is conformed tax in percentage or not for specific tax.

is_brackets_active

Integer

Yes

Null

The is_brackets_active if active then create price bracket data for specific tax.

is_tax_inclusive

Integer

0

The is_tax_inclusive for specific tax.

company_id

Integer

Yes

Null

The company_id for specific tax.

Response

function delete_tax($tax_type_id) {.....}

Usage

Request Parameters

Param
Type
Required
Default
Description

$tax_type_id

Integer

Yes

Null

The id of the tax corresponds to the tax type table

Response

Last updated