Skip to content

Instantly share code, notes, and snippets.

@MrImranJaved
Forked from alexpani/woo_hooks.php
Last active February 1, 2022 14:23
Show Gist options
  • Save MrImranJaved/a1bc35c1a6de994326eb958ea84bd448 to your computer and use it in GitHub Desktop.
Save MrImranJaved/a1bc35c1a6de994326eb958ea84bd448 to your computer and use it in GitHub Desktop.
Gli Hook per WooCommerce
<?php
/** WooCommerce Template Hooks ********************************************************/
/**
* Sale flashes
*/
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );
/**
* Breadcrumbs
*/
add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
/**
* Archive descriptions
*
*/
add_action( 'woocommerce_taxonomy_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
add_action( 'woocommerce_product_archive_description', 'woocommerce_product_archive_description', 10 );
/**
* Products Loop
*/
add_filter( 'loop_end', 'woocommerce_reset_loop' );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_show_messages', 10 );
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
/**
* Subcategories
*/
add_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 );
/**
* Before Single Products
*/
add_action( 'woocommerce_before_single_product', 'woocommerce_show_messages', 10 );
/**
* Before Single Products Summary Div
*/
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
add_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
/**
* After Single Products Summary Div
*/
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 );
/**
* Product Summary Box
*/
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
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_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
/**
* Product Add to cart
*/
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
add_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
add_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
add_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
add_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );
/**
* Pagination in loop-shop
*/
add_action( 'woocommerce_pagination', 'woocommerce_pagination', 10 );
add_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 );
/**
* Product page tabs
*/
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 );
/**
* Checkout
*/
add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_login_form', 10 );
add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
add_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
/**
* Cart
*/
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
/**
* Footer
*/
add_action( 'wp_footer', 'woocommerce_demo_store' );
/** Store Event Hooks *****************************************************/
'show_admin_bar', 'woocommerce_disable_admin_bar', 10, 1 );
/**
* Catalog sorting/ordering
*/
add_action( 'init', 'woocommerce_update_catalog_ordering' );
/**
* RSS Feeds
*/
add_action( 'wp_head', 'woocommerce_products_rss_feed' );
/**
* Star Ratings
*/
add_action( 'comment_post', 'woocommerce_add_comment_rating', 1 );
add_filter( 'preprocess_comment', 'woocommerce_check_comment_rating', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment