Fee / Discount Amounts - Filter Hook References

Modified on Sat, 19 Nov, 2022 at 7:41 PM

This is simply a list of fees & discounts amount-related filter hooks that can be found within the WooCommerce Partial COD - Payment Gateway Restrictions & Fees files. This list also includes the supported parameters and example codes.


woopcd_partialcod-admin/get-amount-type-groups

  • Parameters:
  • $group_types array()
  • $args array()


Example Codes:

function custom_get_amount_type_groups( $group_types, $args ) {

    //add your custom code here
    return $group_types;
}

add_filter( 'woopcd_partialcod-admin/get-amount-type-groups', 'custom_get_amount_type_groups', 10, 2 );

woopcd_partialcod-admin/get-amount-group-types-{group-type-id}

  • Parameters:
  • $amount_types array()
  • $args array()


Example Codes:

function custom_get_amount_types_group_type_id( $amount_types, $args ) {

    //add your custom code here
    return $amount_types;
}

add_filter( 'woopcd_partialcod-admin/get-amount-group-types-{group-type-id}', 'custom_get_amount_types_group_type_id', 10, 2 );

woopcd_partialcod-admin/get-amount-type-{amount_type_id}-fields

  • Parameters:
  • $fields array()
  • $args array()


Example Codes:

function custom_get_amount_type_amount_type_id_fields( $fields, $args ) {

    //add your custom code here
    return $fields;
}

add_filter( 'woopcd_partialcod-admin/get-amount-type-{amount_type_id}-fields', 'custom_get_amount_type_amount_type_id_fields', 10, 2 );

woopcd_partialcod-admin/get-amount-type-fields

  • Parameters:
  • $fields array()
  • $args array()


Example Codes:

function custom_get_amount_type_fields( $fields, $args ) {

    //add your custom code here
    return $fields;
}

add_filter( 'woopcd_partialcod-admin/get-amount-type-fields', 'custom_get_amount_type_fields', 10, 2 );

woopcd_partialcod-admin/get-based-on-required-ids

  • Parameters:
  • $amount_type_ids array()
  • $args array()


Example Codes:

function custom_get_based_on_required_ids( $amount_type_ids, $args ) {

    //add your custom code here
    return $amount_type_ids;
}

add_filter( 'woopcd_partialcod-admin/get-based-on-required-ids', 'custom_get_based_on_required_ids', 10, 2 );

woopcd_partialcod-admin/get-item-based-on-required-ids

  • Parameters:
  • $amount_type_ids array()
  • $args array()


Example Codes:

function custom_get_item_based_on_required_ids( $amount_type_ids, $args ) {

    //add your custom code here
    return $amount_type_ids;
}

add_filter( 'woopcd_partialcod-admin/get-item-based-on-required-ids', 'custom_get_item_based_on_required_ids', 10, 2 );

woopcd_partialcod-admin/get-products-required-ids

  • Parameters:
  • $amount_type_ids array()
  • $args array()


Example Codes:

function custom_get_products_required_ids( $amount_type_ids, $args ) {

    //add your custom code here
    return $amount_type_ids;
}

add_filter( 'woopcd_partialcod-admin/get-products-required-ids', 'custom_get_products_required_ids', 10, 2 );

woopcd_partialcod-admin/{module}/get-products-required-ids

  • Parameters:
  • $amount_type_ids array()
  • $args array()


Example Codes:

function custom_get_module_products_required_ids( $amount_type_ids, $args ) {

    //add your custom code here
    return $amount_type_ids;
}

add_filter( 'woopcd_partialcod-admin/{module}/get-products-required-ids', 'custom_get_module_products_required_ids', 10, 2 );

woopcd_partialcod-admin/get-amount-box-fields

  • Parameters:
  • $fields array()
  • $args array()


Example Codes:

function custom_get_amount_box_fields( $fields, $args ) {

    //add your custom code here
    return $fields;
}

add_filter( 'woopcd_partialcod-admin/get-amount-box-fields', 'custom_get_amount_box_fields', 10, 2 );

woopcd_partialcod-admin/process-amount-options

  • Parameters:
  • $amount array()
  • $raw_amount array()
  • $args array()


Example Codes:

function custom_process_amount_options( $amount, $raw_amount, $args ) {

    //add your custom code here
    return $amount;
}

add_filter( 'woopcd_partialcod-admin/process-amount-options', 'custom_process_amount_options', 10, 3 );

woopcd_partialcod-admin/process-amount-type-{amount_type_id}-options

  • Parameters:
  • $amount array()
  • $raw_amount array()
  • $args array()


Example Codes:

function custom_process_amount_type_id_options( $amount, $raw_amount, $args ) {

    //add your custom code here
    return $amount;
}

add_filter( 'woopcd_partialcod-admin/process-amount-type-{amount_type_id}-options', 'custom_process_amount_type_id_options', 10, 3 );

woopcd_partialcod/calculate-{amount_type_id}-amount

  • Parameters:
  • $amount array()
  • $amount_args array()
  • $cart_data array()


Example Codes:

function custom_calculate_amount_type_id( $amount, $amount_args, $cart_data ) {

    //add your custom code here
    $calc_amount = 10;
    return WOOPCD_PartialCOD_Amount_Types::prepare_amount( $amount, $calc_amount );
}

add_filter( 'woopcd_partialcod/calculate-{amount_type_id}-amount', 'custom_calculate_amount_type_id', 10, 3 );



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article