WooCommerce Visual Hook Guide
Single Product & Archive (Shop) lehe hookide visuaalne kaart Visual map of hooks for Single Product & Archive (Shop) pages
Action hook (add_action)
Action hook (add_action)
Eemaldatav vaikimisi action
Removable default action
Filter hook (add_filter)
Filter hook (add_filter)
single-product.php
woocommerce_before_single_product
woocommerce_template_single_meta 40
woocommerce_template_single_sharing 50
woocommerce_upsell_display 15
woocommerce_after_single_product
woocommerce_before_single_product_summary
woocommerce_show_product_sale_flash priority: 10
woocommerce_show_product_images priority: 20
SALE!
🖼️
woocommerce_single_product_summary
woocommerce_template_single_title 5
Toote pealkiri
Product Title
woocommerce_template_single_rating 10
★★★★☆ (12)
woocommerce_template_single_price 10
€50,00 €44,00
woocommerce_template_single_excerpt 20
See on toote lühikirjeldus.
This is the short description.
woocommerce_template_single_add_to_cart 30
[ 🔗
Jaga
Share
]
woocommerce_after_single_product_summary
woocommerce_output_product_data_tabs 10
Kirjeldus
Description
Arvustused
Reviews
Lisainfo
Additional info
Filter hookid – Single Product
Filter Hooks – Single Product
woocommerce_product_title add_filter
woocommerce_product_single_add_to_cart_text add_filter
woocommerce_short_description add_filter
woocommerce_product_tabs add_filter
archive-product.php
woocommerce_before_main_content
woocommerce_after_shop_loop 10
Shop
woocommerce_archive_description 10woocommerce_before_shop_loop
woocommerce_output_all_notices 10
woocommerce_result_count 20
woocommerce_catalog_ordering 30
woocommerce_before_shop_loop_item
woocommerce_before_shop_loop_item_title10
🖼️
woocommerce_shop_loop_item_title10
Toote pealkiri
Product Title
woocommerce_after_shop_loop_item_title10
€44,00
woocommerce_after_shop_loop_item10
woocommerce_before_shop_loop_item
woocommerce_before_shop_loop_item_title10
🖼️
woocommerce_shop_loop_item_title10
Test 6
woocommerce_after_shop_loop_item_title10
€5,00
woocommerce_after_shop_loop_item10
« 1 2 3 »
woocommerce_after_main_content
Filter hookid – Archive/Shop
Filter Hooks – Archive/Shop
woocommerce_product_loop_title add_filter
woocommerce_loop_add_to_cart_link add_filter
loop_shop_per_page add_filter
loop_shop_columns add_filter
woocommerce_catalog_orderby add_filter
Praktilised koodinäited – child theme functions.php
Practical examples – child theme functions.php
remove_action
Eemalda tähthinnang
Remove star rating
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
remove_action
Eemalda jagamisnupud
Remove sharing buttons
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
add_action
Lisa tarne info hinna alla
Add shipping info below price
add_action(
'woocommerce_single_product_summary',
function() {
echo '<p class="ship-info">'
. '🚚 Tasuta tarne üle 50€'
. '</p>';
},
15 // after price [10], before excerpt [20]
);
add_filter
Muuda “Lisa ostukorvi” teksti
Change “Add to cart” text
add_filter(
'woocommerce_product_single_add_to_cart_text',
function() {
return 'Telli kohe';
}
);
remove_action
Eemalda nupp shop lehelt
Remove button from shop loop
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action
“Uus!” märgis shop lehel
“New!” badge in shop loop
add_action(
'woocommerce_before_shop_loop_item_title',
function() {
global $product;
$created = strtotime(
$product->get_date_created()
);
$age = (time()-$created)/DAY_IN_SECONDS;
if ($age < 30) {
echo '<span class="new-badge">Uus!</span>';
}
},
15
);
add_filter
Muuda toodete arv real
Change products per row
add_filter(
'loop_shop_columns',
function() {
return 3; // 3 toodet real
}
);
add_filter
Toodete arv lehel
Products per page
add_filter(
'loop_shop_per_page',
function() {
return 24;
}
);
Täielik viide – kõik eemaldatavad vaikimisi actionid
Full reference – all removable default actions
single-product – default actions
// woocommerce_before_single_product_summary add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 ); add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); // woocommerce_single_product_summary add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 ); // woocommerce_after_single_product_summary add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
archive/shop – default actions
// woocommerce_before_shop_loop add_action( 'woocommerce_before_shop_loop', 'woocommerce_output_all_notices', 10 ); add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); // woocommerce_before_shop_loop_item add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); // woocommerce_before_shop_loop_item_title add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 ); add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); // woocommerce_shop_loop_item_title add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); // woocommerce_after_shop_loop_item_title add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); // woocommerce_after_shop_loop_item add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 ); add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); // woocommerce_after_shop_loop add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );