Cart Total Calculations - Filter Hook References

Cart Total Calculations - Filter Hook References

This is simply a list of cart total calculation-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/method-options/get-cart-totals-options

  • Parameters:
  • $options array()

Example Codes:

  1. function custom_get_method_options_cart_totals_options( $options ) {
  2.    //add your custom code here
  3.    return $options;
  4. }
  5. add_filter( 'woopcd_partialcod-admin/method-options/get-cart-totals-options', 'custom_get_method_options_cart_totals_options', 10, 1 );

woopcd_partialcod-admin/partial-payment/get-cart-totals-options

  • Parameters:
  • $options array()

Example Codes:

  1. function custom_get_partial_payment_cart_totals_options( $options ) {
  2.    //add your custom code here
  3.    return $options;
  4. }
  5. add_filter( 'woopcd_partialcod-admin/partial-payment/get-cart-totals-options', 'custom_get_partial_payment_cart_totals_options', 10, 1 );

woopcd_partialcod-admin/cart-discounts/get-cart-totals-options

  • Parameters:
  • $options array()

Example Codes:

  1. function custom_get_cart_discounts_cart_totals_options( $options ) {
  2.    //add your custom code here
  3.    return $options;
  4. }
  5. add_filter( 'woopcd_partialcod-admin/cart-discounts/get-cart-totals-options', 'custom_get_cart_discounts_cart_totals_options', 10, 1 );

woopcd_partialcod-admin/cart-fees/get-cart-totals-options

  • Parameters:
  • $options array()

Example Codes:

  1. function custom_get_cart_fees_cart_totals_options( $options ) {
  2.    //add your custom code here
  3.    return $options;
  4. }
  5. add_filter( 'woopcd_partialcod-admin/cart-fees/get-cart-totals-options', 'custom_get_cart_fees_cart_totals_options', 10, 1 );

woopcd_partialcod-admin/order-activities/get-order-totals-options

  • Parameters:
  • $options array()

Example Codes:

  1. function custom_get_order_activities_cart_totals_options( $options ) {
  2.    //add your custom code here
  3.    return $options;
  4. }
  5. add_filter( 'woopcd_partialcod-admin/order-activities/get-order-totals-options', 'custom_get_order_activities_cart_totals_options', 10, 1 );

woopcd_partialcod/calculate-cart-{option_id}-totals

  • Parameters:
  • $totals numeric
  • $cart_data array()

Example Codes:

  1. function custom_calculate_cart_option_id_totals( $totals, $cart_data ) {
  2.   //add your custom code here
  3.    return $totals;
  4. }
  5. add_filter( 'woopcd_partialcod/calculate-cart-{option_id}-totals', 'custom_calculate_cart_option_id_totals', 10, 2 );

woopcd_partialcod/calculate-order-{option_id}-totals

  • Parameters:
  • $totals numeric
  • $cart_data array()

Example Codes:

  1. function custom_calculate_order_option_id_totals( $totals, $cart_data ) {
  2.    //add your custom code here
  3.    return $totals;
  4. }
  5. add_filter( 'woopcd_partialcod/calculate-order-{option_id}-totals', 'custom_calculate_order_option_id_totals', 10, 2 );