Cart Data - Filter Hook References

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

This is simply a list of cart data-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/get-cart-item

  • Parameters:
  • $item array()
  • $cart_item array()


Example Codes:

function custom_get_cart_item( $item, $cart_item ) {

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

add_filter( 'woopcd_partialcod/get-cart-item', 'custom_get_cart_item', 10, 2 );

woopcd_partialcod/get-cart-product-data

  • Parameters:
  • $item_data array()
  • $product object
  • $item_key string


Example Codes:

function custom_get_cart_product_data( $item_data, $product, $item_key ) {

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

add_filter( 'woopcd_partialcod/get-cart-product-data', 'custom_get_cart_product_data', 10, 3 );

woopcd_partialcod/get-cart-totals

  • Parameters:
  • $cart_totals array()
  • $source string
  • $cart object


Example Codes:

function custom_get_cart_totals( $cart_totals, $source, $cart ) {

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

add_filter( 'woopcd_partialcod/get-cart-totals', 'custom_get_cart_totals', 10, 3 );

woopcd_partialcod/get-cart-applied-coupons

  • Parameters:
  • $cart_applied_coupons array()
  • $source string
  • $cart object


Example Codes:

function custom_get_cart_applied_coupons( $cart_applied_coupons, $source, $cart ) {

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

add_filter( 'woopcd_partialcod/get-cart-applied-coupons', 'custom_get_cart_applied_coupons', 10, 3 );

woopcd_partialcod/get-cart-shipping-rates

  • Parameters:
  • $cart_shipping_rates array()
  • $source string
  • $cart object


Example Codes:

function custom_get_cart_shipping_rates( $cart_shipping_rates, $source, $cart ) {

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

add_filter( 'woopcd_partialcod/get-cart-shipping-rates', 'custom_get_cart_shipping_rates', 10, 3 );

woopcd_partialcod/get-cart-method-ids

  • Parameters:
  • $cart_method_ids array()
  • $source string
  • $cart object


Example Codes:

function custom_get_cart_method_ids( $cart_method_ids, $source, $cart ) {

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

add_filter( 'woopcd_partialcod/get-cart-method-ids', 'custom_get_cart_method_ids', 10, 3 );

woopcd_partialcod/get-external-fees

  • Parameters:
  • $cart_external_fees array()
  • $source string
  • $cart object


Example Codes:

function custom_get_external_fees( $cart_external_fees, $source, $cart ) {

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

add_filter( 'woopcd_partialcod/get-external-fees', 'custom_get_external_fees', 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