Shipping Rates - Filter Hook References

Shipping Rates - Filter Hook References

This is simply a list of shipping rates-related filter hooks found within the WooCommerce Table Rate Shipping files. This list also includes the supported parameters and example codes.


wtars_shipped/rate-cost

  • Parameters:
  • $rate_cost array()
  • $rate_id array()
  • $instance_id array()

Example Codes:

  1. function custom_rate_cost( $rate_cost, $rate_id, $instance_id ) {
  2.   //add your custom code here
  3.   return $rate_cost;
  4. }
  5. add_filter( 'wtars_shipped/rate-cost', 'custom_rate_cost', 10, 3 );

wtars_shipped/rate-fee

  • Parameters:
  • $rate_fee array()
  • $rate array()
  • $fee array()
  • $instance_id array()

Example Codes:

  1. function custom_rate_fee( $rate_fee, $rate, $fee, $instance_id ) {
  2.   //add your custom code here
  3.   return $rate_fee;
  4. }
  5. add_filter( 'wtars_shipped/rate-fee', 'custom_rate_fee', 10, 4 );

wtars_shipped/rate-taxes

  • Parameters:
  • $rate_taxes array()
  • $rate_id array()
  • $instance_id array()

Example Codes:

  1. function custom_rate_taxes( $rate_taxes, $rate_id, $instance_id ) {
  2.   //add your custom code here
  3.   return $rate_taxes;
  4. }
  5. add_filter( 'wtars_shipped/rate-taxes', 'custom_rate_taxes', 10, 3 );

wtars_shipped/rate-title

  • Parameters:
  • $rate_title array()
  • $rate_id array()
  • $instance_id array()

Example Codes:

  1. function custom_rate_title( $rate_title, $rate_id, $instance_id ) {
  2.   //add your custom code here
  3.   return $rate_title;
  4. }
  5. add_filter( 'wtars_shipped/rate-title', 'custom_rate_title', 10, 3 );

wtars_shipped/rate-desc

  • Parameters:
  • $rate_desc array()
  • $rate_id array()
  • $instance_id array()

Example Codes:

  1. function custom_rate_desc( $rate_desc, $rate_id, $instance_id ) {
  2.   //add your custom code here
  3.   return $rate_desc;
  4. }
  5. add_filter( 'wtars_shipped/rate-desc', 'custom_rate_desc', 10, 3 );

wtars_shipped/rate-tooltip

  • Parameters:
  • $rate_tooltip array()
  • $rate_id array()
  • $instance_id array()

Example Codes:

  1. function custom_rate_tooltip( $rate_tooltip, $rate_id, $instance_id ) {
  2.   //add your custom code here
  3.   return $rate_tooltip;
  4. }
  5. add_filter( 'wtars_shipped/rate-tooltip', 'custom_rate_tooltip', 10, 3 );

wtars_shipped/rate-meta

  • Parameters:
  • $rate_metas array()
  • $rate_id array()
  • $instance_id array()

Example Codes:

  1. function custom_rate_meta( $rate_metas, $rate_id, $instance_id ) {
  2.   //add your custom code here
  3.   return $rate_metas;
  4. }
  5. add_filter( 'wtars_shipped/rate-meta', 'custom_rate_meta', 10, 3 );