Hooks and Extensions

9

questions

Do PHP overrides work in a block theme?

Not for the parts rendered by blocks: a block has its own render. Some blocks (for example, the classic Legacy Template) still use PHP templates, but the main path is blocks.

How do you find the priority WooCommerce used to add a function?

Look in includes/wc-template-hooks.php, in Query Monitor → Hooks, or dump $wp_filter['hook_name'].

What does Requires Plugins do?

A plugin header since WordPress 6.5. Core won't activate the plugin until its dependencies are active, and won't deactivate a dependency while a dependent plugin is active.

What is a dynamic hook? Give an example.

A hook whose name contains a variable part. For example, woocommerce_order_status_completed or woocommerce_product_get_price — WooCommerce builds them from a status or property name.

What is the difference between an action and a filter?

An action does something at a given moment and returns nothing. A filter receives a value, changes it and must return it. Technically both run on the same WP_Hook system.

What should a client choose: a block or a classic theme?

It depends on the project. A block theme gives code-free editing of store templates and the modern checkout. A classic one fits when many extensions depend on PHP templates and checkout hooks. Back the decision with a plugin audit.

Where does WooCommerce show the theme's outdated templates?

WooCommerce → Status → System status, the Templates section. It shows the copy's version and the core version.

Which hook do you declare compatibility on, and why?

before_woocommerce_init: WooCommerce collects declarations before it initializes features. A later declaration is ignored.

Why WC tested up to?

WooCommerce shows a warning in the plugin list if the WooCommerce version is newer than the tested one. It's a signal for the admin before updating.