Cart Total Calculations - Filter Hook References

Modified on Sat, 19 Nov 2022 at 08:50 PM

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:

function custom_get_method_options_cart_totals_options( $options ) {

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

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:

function custom_get_partial_payment_cart_totals_options( $options ) {

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

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:

function custom_get_cart_discounts_cart_totals_options( $options ) {

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

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:

function custom_get_cart_fees_cart_totals_options( $options ) {

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

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:

function custom_get_order_activities_cart_totals_options( $options ) {

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

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:

function custom_calculate_cart_option_id_totals( $totals, $cart_data ) {

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

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:

function custom_calculate_order_option_id_totals( $totals, $cart_data ) {

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

add_filter( 'woopcd_partialcod/calculate-order-{option_id}-totals', 'custom_calculate_order_option_id_totals', 10, 2 );


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 atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article