Do not edit Woo Pages directly (to avoid deleting Woo shortcodes), use hooks instead.
- If I see
do_action()
it means that I can run my custom function there, in that specific postition, WITHOUT a need of overriding a WooCommerce template. - Full list of shortcodes available in
includes/class-wc-shortcodes.php
file. - I can include full product page on my custom page with a shortcode
[product_page id="1"]
. - If WP/Woo privdes me with a hook
do_action()
it means that I can run a custom function then/there.
do_action( 'hook_name', 'function_name', 10, 1 );
- The code above goes into the
functions.php
flile of the child theme. - It has the same name as per
do_action()
. - Priority =
10
by default, if omitted. - Aarguments =
1
by default, if omitted.
function function_name() { }
-
Hooked function (name as per
add_action()
). -
$arguments
as perdo_action()
. -
Wordpress Filter Hooks allow me to edit / filter content just before it is given back to WordPress.
-
If WP/Woo provides me with a
apply_filters( 'hook_name' )
I can edit that content before it is processed.
-
... add more content here ...
-
Add content child theme related from my screenshots.
-
check and validate child theme styles with a different name/folder
-
CSS
-
cascading - explain which one will win and why
-
explain css syntax for novice users
-
add inspecting explaination
-
CSS hierarchy, add precision in location (why one should never use 1 & 2)
-
explain woocommerce CSS structure
do_action( 'save_post_product', 'my_custom_function' );
function my_custom_function() {
// do something when a product (post) is saved
}
do_action( 'woocommerce_before_cart', 'my_above_cart_banner_function' );
function my_above_cart_banner_function() {
// do something before the Cart table
}
- WooCommerce source
- WordPress Developer Resources
- WooCommerce developer resources
- Child Themes
- WooCommerce CSS Structure
- How to set up and use a child theme
- WordPress Hooks
- WooCommerce Hooks: Actions and filters
- Woo Extensibility on the Server Side (Hooks)
- WooCommerce Pages
- WooCommerce Shortcodes
- Full list of Woo shortcodes