Product Rules - Filter Hook References

Modified on Sat, 19 Nov, 2022 at 8:29 PM

This is simply a list of product rule-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-product-filter-groups

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


Example Codes:

function custom_get_product_filter_groups( $group_types, $args ) {

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

add_filter( 'woopcd_partialcod-admin/get-product-filter-groups', 'custom_get_product_filter_groups', 10, 2 );

woopcd_partialcod-admin/get-{group_type_id}-group-product-filters

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


Example Codes:

function custom_get_group_type_id_product_filters( $filter_types, $args ) {

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

add_filter( 'woopcd_partialcod-admin/get-{group_type_id}-group-product-filters', 'custom_get_group_type_id_product_filters', 10, 2 );

woopcd_partialcod-admin/get-{filter_type_id}-product-filter-fields

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


Example Codes:

function custom_get_filter_type_id_product_filter_fields( $fields, $args ) {

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

add_filter( 'woopcd_partialcod-admin/get-{filter_type_id}-product-filter-fields', 'custom_get_filter_type_id_product_filter_fields', 10, 2 );

woopcd_partialcod/validate-{filter_type_id}-filter

  • Parameters:
  • $filter_args array()
  • $cart_item array()
  • $cart_data array()


Example Codes:

function custom_validate_filter_type_id_product_fitler( $filter_args, $cart_item, $cart_data ) {

    //add your custom code here
    return true; // true or false
}

add_filter( 'woopcd_partialcod/validate-{filter_type_id}-filter', 'custom_validate_filter_type_id_product_fitler', 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