I'm customizing a Woocommerce Wordpress site.
In the Woocommerce product class (class-wc-product.php) the get_price function applies a filter as follows:
function get_price() {
return apply_filters('woocommerce_get_price', $this->price, $this);
}
In my functions.php I want to add a filter as follows:
add_filter('woocommerce_get_price', 'custom_price');
function custom_price($price, $product) {
...
}
When I call this I get the following PHP warning:
Warning: Missing argument 2 for custom_price()
Why is the second argument missing? Is $this not sent to the filter call?
apply_filters('woocommerce_get_price', … );is called somewhere else without the second argument? Did you search for such a case? – toscho♦ Nov 12 '12 at 15:10