Filter uncanny-learndash-groups

ulgm_group_license_tax_statuses

Filters the available license statuses for groups, allowing modification before they are displayed.

add_filter( 'ulgm_group_license_tax_statuses', $callback, 10, 1 );

Description

Filters the available tax statuses for group licenses. Developers can add, remove, or modify options like 'taxable', 'shipping', and 'none' to customize how taxes are applied to group licenses. This hook fires before the tax status selection is rendered in the admin area.


Usage

add_filter( 'ulgm_group_license_tax_statuses', 'your_function_name', 10, 1 );

Parameters

$tax_statuses (mixed)
This parameter contains an array of possible tax statuses for a license, allowing for customization of options like taxable, shipping-only, or none.

Return Value

The filtered value.


Examples

/**
 * Add a new tax status option for group licenses.
 *
 * This example demonstrates how to add a new tax status, 'vat_reverse_charge',
 * to the available options for group license tax statuses.
 *
 * @param array $tax_statuses The current array of tax statuses.
 * @return array The modified array of tax statuses including the new option.
 */
add_filter( 'ulgm_group_license_tax_statuses', function( $tax_statuses ) {
    // Add a new tax status option for VAT Reverse Charge.
    // This might be useful for businesses dealing with international B2B sales.
    $tax_statuses['vat_reverse_charge'] = __( 'VAT Reverse Charge', 'your-text-domain' );

    return $tax_statuses;
}, 10, 1 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/templates/admin/admin-groups.php:954

$tax_statuses = array(
											'taxable'  => __( 'Taxable', 'woocommerce' ),
											'shipping' => __( 'Shipping only', 'woocommerce' ),
											'none'     => _x( 'None', 'Tax status', 'woocommerce' ),
										);

										$tax_statuses = apply_filters( 'ulgm_group_license_tax_statuses', $tax_statuses );

										$default  = get_option( 'ulgm_group_license_tax_status', '' );
										$selected = 'selected="selected"';
										$j        = 0;
										?>
										<select name="ulgm_group_license_tax_status"
												class="uo-admin-select"

Scroll to Top