Exercise 1: Why an Action, Not a Filter, for a Price Change — Possible Solution ==================================================================== WHAT DETERMINES ACTION VS. FILTER ------------------------------ Per this chapter's own recap table, the distinction isn't about whether a value changes - it's about the hook's own shape: a filter exists to modify a specific value and must return it, while an action exists to "do something at this point" with no return value expected. WHY woocommerce_before_calculate_totals IS AN ACTION ------------------------------ Per this chapter, this hook acts on the whole $cart object passed into it - looping through every cart item and calling set_price() directly on each product object inside the cart, rather than receiving a single price value, modifying it, and returning the modified value. There's nothing to "return" here; the function mutates the cart's own item objects directly, which is exactly the action pattern rather than the filter pattern - the chapter states this directly: "an action, despite modifying a price, because it acts on the whole cart object rather than returning a single filtered value." WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly identifies that action-vs-filter depends on the hook's own shape (mutate-in-place vs. modify-and-return), not simply on whether the end result changes a price, and correctly applies that distinction to explain why this specific hook is an action.