WooCommerce Cart Hooks — a practical guide to WooCommerce cart hooks with clear examples you can reuse in real projects.
WooCommerce Plugin Development Series (10/101). Prefer one article? Read the complete WooCommerce plugin development tutorial.
Short description
Use cart hooks for fees, notices, and item meta. Recalculate carefully to avoid loops.
Cart fee hook
add_action('woocommerce_cart_calculate_fees', function ($cart) {
if (is_admin() && ! defined('DOING_AJAX')) return;
$cart->add_fee(__('Handling', 'acme-woo'), 20);
});