2013-08-09 16:11:15 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-11-03 13:53:50 +00:00
|
|
|
* WooCommerce Template Hooks
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2015-11-03 13:31:20 +00:00
|
|
|
* Action/filter hooks used for WooCommerce functions/templates.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2018-03-08 19:48:20 +00:00
|
|
|
* @package WooCommerce/Templates
|
|
|
|
* @version 2.1.0
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
|
|
|
|
2018-03-08 19:48:20 +00:00
|
|
|
defined( 'ABSPATH' ) || exit;
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
add_filter( 'body_class', 'wc_body_class' );
|
|
|
|
add_filter( 'post_class', 'wc_product_post_class', 20, 3 );
|
2014-03-03 13:37:45 +00:00
|
|
|
|
2014-09-20 19:11:09 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* WP Header.
|
2014-03-03 13:37:45 +00:00
|
|
|
*
|
2018-03-08 19:48:20 +00:00
|
|
|
* @see wc_generator_tag()
|
2014-03-03 13:37:45 +00:00
|
|
|
*/
|
2014-03-12 11:53:59 +00:00
|
|
|
add_action( 'get_the_generator_html', 'wc_generator_tag', 10, 2 );
|
|
|
|
add_action( 'get_the_generator_xhtml', 'wc_generator_tag', 10, 2 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Content Wrappers.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_output_content_wrapper()
|
|
|
|
* @see woocommerce_output_content_wrapper_end()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
|
|
|
add_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Sale flashes.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_show_product_loop_sale_flash()
|
|
|
|
* @see woocommerce_show_product_sale_flash()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
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 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Breadcrumbs.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_breadcrumb()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Sidebar.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_get_sidebar()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Archive descriptions.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_taxonomy_archive_description()
|
|
|
|
* @see woocommerce_product_archive_description()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
|
|
|
|
add_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
2017-12-06 18:10:28 +00:00
|
|
|
/**
|
|
|
|
* Product loop start.
|
|
|
|
*/
|
|
|
|
add_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );
|
|
|
|
|
2013-08-09 16:11:15 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Products Loop.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_result_count()
|
|
|
|
* @see woocommerce_catalog_ordering()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
|
|
|
|
add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
|
2016-08-08 12:43:42 +00:00
|
|
|
add_action( 'woocommerce_no_products_found', 'wc_no_products_found' );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Product Loop Items.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2015-10-01 13:49:35 +00:00
|
|
|
* @see woocommerce_template_loop_product_link_open()
|
|
|
|
* @see woocommerce_template_loop_product_link_close()
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_template_loop_add_to_cart()
|
|
|
|
* @see woocommerce_template_loop_product_thumbnail()
|
2015-10-01 14:12:50 +00:00
|
|
|
* @see woocommerce_template_loop_product_title()
|
2015-12-07 03:03:40 +00:00
|
|
|
* @see woocommerce_template_loop_category_link_open()
|
|
|
|
* @see woocommerce_template_loop_category_title()
|
|
|
|
* @see woocommerce_template_loop_category_link_close()
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_template_loop_price()
|
|
|
|
* @see woocommerce_template_loop_rating()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2015-10-01 13:49:35 +00:00
|
|
|
add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
|
|
|
|
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
|
2013-11-25 14:16:26 +00:00
|
|
|
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 );
|
2015-07-20 17:10:56 +00:00
|
|
|
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
|
2015-10-01 14:28:57 +00:00
|
|
|
|
|
|
|
add_action( 'woocommerce_before_subcategory', 'woocommerce_template_loop_category_link_open', 10 );
|
|
|
|
add_action( 'woocommerce_shop_loop_subcategory_title', 'woocommerce_template_loop_category_title', 10 );
|
|
|
|
add_action( 'woocommerce_after_subcategory', 'woocommerce_template_loop_category_link_close', 10 );
|
|
|
|
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
|
|
|
|
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Subcategories.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_subcategory_thumbnail()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Before Single Products Summary Div.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_show_product_images()
|
|
|
|
* @see woocommerce_show_product_thumbnails()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
|
|
|
|
add_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* After Single Products Summary Div.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_output_product_data_tabs()
|
|
|
|
* @see woocommerce_upsell_display()
|
|
|
|
* @see woocommerce_output_related_products()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
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 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Product Summary Box.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_template_single_title()
|
2015-12-07 03:03:40 +00:00
|
|
|
* @see woocommerce_template_single_rating()
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_template_single_price()
|
|
|
|
* @see woocommerce_template_single_excerpt()
|
|
|
|
* @see woocommerce_template_single_meta()
|
|
|
|
* @see woocommerce_template_single_sharing()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
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_meta', 40 );
|
|
|
|
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
2016-03-07 15:33:44 +00:00
|
|
|
/**
|
|
|
|
* Reviews
|
|
|
|
*
|
|
|
|
* @see woocommerce_review_display_gravatar()
|
|
|
|
* @see woocommerce_review_display_rating()
|
|
|
|
* @see woocommerce_review_display_meta()
|
|
|
|
* @see woocommerce_review_display_comment_text()
|
|
|
|
*/
|
|
|
|
add_action( 'woocommerce_review_before', 'woocommerce_review_display_gravatar', 10 );
|
|
|
|
add_action( 'woocommerce_review_before_comment_meta', 'woocommerce_review_display_rating', 10 );
|
|
|
|
add_action( 'woocommerce_review_meta', 'woocommerce_review_display_meta', 10 );
|
|
|
|
add_action( 'woocommerce_review_comment_text', 'woocommerce_review_display_comment_text', 10 );
|
|
|
|
|
2013-08-09 16:11:15 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Product Add to cart.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_template_single_add_to_cart()
|
|
|
|
* @see woocommerce_simple_add_to_cart()
|
|
|
|
* @see woocommerce_grouped_add_to_cart()
|
|
|
|
* @see woocommerce_variable_add_to_cart()
|
|
|
|
* @see woocommerce_external_add_to_cart()
|
2015-12-07 03:03:40 +00:00
|
|
|
* @see woocommerce_single_variation()
|
|
|
|
* @see woocommerce_single_variation_add_to_cart_button()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
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 );
|
2015-07-28 09:32:28 +00:00
|
|
|
add_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 );
|
|
|
|
add_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Pagination after shop loops.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
|
|
|
* @see woocommerce_pagination()
|
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Product page tabs.
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_filter( 'woocommerce_product_tabs', 'woocommerce_default_product_tabs' );
|
|
|
|
add_filter( 'woocommerce_product_tabs', 'woocommerce_sort_product_tabs', 99 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
2016-12-17 22:53:45 +00:00
|
|
|
/**
|
|
|
|
* Additional Information tab.
|
|
|
|
*
|
|
|
|
* @see wc_display_product_attributes()
|
|
|
|
*/
|
|
|
|
add_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 );
|
|
|
|
|
2013-08-09 16:11:15 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Checkout.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_checkout_login_form()
|
|
|
|
* @see woocommerce_checkout_coupon_form()
|
|
|
|
* @see woocommerce_order_review()
|
2015-12-07 03:03:40 +00:00
|
|
|
* @see woocommerce_checkout_payment()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
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 );
|
2014-11-26 14:19:53 +00:00
|
|
|
add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 );
|
|
|
|
|
2016-07-28 14:06:51 +00:00
|
|
|
/**
|
|
|
|
* Cart widget
|
|
|
|
*/
|
|
|
|
add_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_button_view_cart', 10 );
|
|
|
|
add_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Cart.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_cross_sell_display()
|
2015-04-09 14:15:37 +00:00
|
|
|
* @see woocommerce_cart_totals()
|
2014-10-06 11:33:36 +00:00
|
|
|
* @see woocommerce_button_proceed_to_checkout()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
|
2015-04-09 14:15:37 +00:00
|
|
|
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 );
|
|
|
|
add_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
|
2017-04-26 12:25:14 +00:00
|
|
|
add_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Footer.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2014-03-03 13:37:45 +00:00
|
|
|
* @see wc_print_js()
|
2013-08-09 16:11:15 +00:00
|
|
|
* @see woocommerce_demo_store()
|
|
|
|
*/
|
2014-03-03 13:37:45 +00:00
|
|
|
add_action( 'wp_footer', 'wc_print_js', 25 );
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'wp_footer', 'woocommerce_demo_store' );
|
2013-08-09 16:11:15 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Order details.
|
2013-08-09 16:11:15 +00:00
|
|
|
*
|
2013-11-25 14:16:26 +00:00
|
|
|
* @see woocommerce_order_details_table()
|
2015-12-07 03:03:40 +00:00
|
|
|
* @see woocommerce_order_again_button()
|
2013-08-09 16:11:15 +00:00
|
|
|
*/
|
2013-11-25 14:16:26 +00:00
|
|
|
add_action( 'woocommerce_view_order', 'woocommerce_order_details_table', 10 );
|
|
|
|
add_action( 'woocommerce_thankyou', 'woocommerce_order_details_table', 10 );
|
|
|
|
add_action( 'woocommerce_order_details_after_order_table', 'woocommerce_order_again_button' );
|
2015-04-22 15:27:12 +00:00
|
|
|
|
2017-07-11 12:45:35 +00:00
|
|
|
/**
|
|
|
|
* Order downloads.
|
|
|
|
*
|
|
|
|
* @see woocommerce_order_downloads_table()
|
|
|
|
*/
|
|
|
|
add_action( 'woocommerce_available_downloads', 'woocommerce_order_downloads_table', 10 );
|
|
|
|
|
2015-04-22 15:27:12 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Auth.
|
2015-04-22 15:27:12 +00:00
|
|
|
*
|
|
|
|
* @see woocommerce_output_auth_header()
|
|
|
|
* @see woocommerce_output_auth_footer()
|
|
|
|
*/
|
|
|
|
add_action( 'woocommerce_auth_page_header', 'woocommerce_output_auth_header', 10 );
|
|
|
|
add_action( 'woocommerce_auth_page_footer', 'woocommerce_output_auth_footer', 10 );
|
2015-10-30 15:08:44 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Comments.
|
2015-10-30 15:08:44 +00:00
|
|
|
*
|
2015-11-03 13:31:20 +00:00
|
|
|
* Disable Jetpack comments.
|
2015-10-30 15:08:44 +00:00
|
|
|
*/
|
|
|
|
add_filter( 'jetpack_comment_form_enabled_for_product', '__return_false' );
|
2016-01-14 20:35:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* My Account.
|
|
|
|
*/
|
2016-05-30 13:16:26 +00:00
|
|
|
add_action( 'woocommerce_account_navigation', 'woocommerce_account_navigation' );
|
2016-06-06 11:04:59 +00:00
|
|
|
add_action( 'woocommerce_account_content', 'woocommerce_account_content' );
|
2016-01-20 15:30:48 +00:00
|
|
|
add_action( 'woocommerce_account_orders_endpoint', 'woocommerce_account_orders' );
|
|
|
|
add_action( 'woocommerce_account_view-order_endpoint', 'woocommerce_account_view_order' );
|
|
|
|
add_action( 'woocommerce_account_downloads_endpoint', 'woocommerce_account_downloads' );
|
|
|
|
add_action( 'woocommerce_account_edit-address_endpoint', 'woocommerce_account_edit_address' );
|
2016-01-20 20:13:17 +00:00
|
|
|
add_action( 'woocommerce_account_payment-methods_endpoint', 'woocommerce_account_payment_methods' );
|
2016-01-20 15:30:48 +00:00
|
|
|
add_action( 'woocommerce_account_add-payment-method_endpoint', 'woocommerce_account_add_payment_method' );
|
2016-01-20 20:13:17 +00:00
|
|
|
add_action( 'woocommerce_account_edit-account_endpoint', 'woocommerce_account_edit_account' );
|