| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/www/wp-content/themes/trackstore/framework/modules/woocommerce/ |
Upload File : |
<?php
// Adds theme support for WooCommerce
add_theme_support( 'woocommerce' );
// Disable the default WooCommerce stylesheet
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
if ( ! function_exists( 'trackstore_elated_disable_woocommerce_pretty_photo' ) ) {
/**
* Function that disable WooCommerce pretty photo script and style
*/
function trackstore_elated_disable_woocommerce_pretty_photo() {
if ( trackstore_elated_load_woo_assets() ) {
wp_deregister_style( 'woocommerce_prettyPhoto_css' );
}
}
add_action( 'wp_enqueue_scripts', 'trackstore_elated_disable_woocommerce_pretty_photo' );
}
if ( ! function_exists( 'trackstore_elated_woocommerce_content' ) ) {
/**
* Output WooCommerce content.
*
* This function is only used in the optional 'woocommerce.php' template
* which people can add to their themes to add basic woocommerce support
* without hooks or modifying core templates.
*
* @access public
* @return void
*/
function trackstore_elated_woocommerce_content() {
if ( is_singular( 'product' ) ) {
while ( have_posts() ) : the_post();
wc_get_template_part( 'content', 'single-product' );
endwhile;
} else {
if ( have_posts() ) :
/**
* woocommerce_before_shop_loop hook.
*
* @hooked woocommerce_result_count - 20
* @hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();
woocommerce_product_subcategories();
while ( have_posts() ) : the_post();
wc_get_template_part( 'content', 'product' );
endwhile; // end of the loop.
woocommerce_product_loop_end();
/**
* woocommerce_after_shop_loop hook.
*
* @hooked woocommerce_pagination - 10
*/
do_action( 'woocommerce_after_shop_loop' );
elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) :
wc_get_template( 'loop/no-products-found.php' );
endif;
}
}
}
/*************** GENERAL FILTERS - begin ***************/
//New product template
add_action('woocommerce_before_shop_loop_item_title', 'trackstore_elated_woocommerce_new_product_mark', 10);
//Add additional html tags around woocommerce pagination
add_action('woocommerce_after_shop_loop', 'trackstore_elated_woo_view_all_pagination_additional_tag_before', 9);
add_action('woocommerce_after_shop_loop', 'trackstore_elated_woo_view_all_pagination_additional_tag_after', 12);
/*************** GENERAL FILTERS - end ***************/
/*************** PRODUCT LISTS FILTERS - begin ***************/
//Add additional html tags around product lists
add_action( 'woocommerce_before_shop_loop', 'trackstore_elated_pl_holder_additional_tag_before', 35 );
add_action( 'woocommerce_after_shop_loop', 'trackstore_elated_pl_holder_additional_tag_after', 5 );
//Add additional html tag around product elements
add_action( 'woocommerce_before_shop_loop_item', 'trackstore_elated_pl_inner_additional_tag_before', 5 );
//Remove open and close link position
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
//Add additional html tags around image and marks
add_action( 'woocommerce_before_shop_loop_item_title', 'trackstore_elated_pl_image_additional_tag_before', 5 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_image_additional_tag_after', 6 );
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'trackstore_elated_pl_image_additional_tag_after', 1 );
/*************** Product Info Position Is On Image Hover ***************/
//Add additional html tag around product elements
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'trackstore_elated_pl_inner_additional_tag_after', 22 );
//Add open and close link position
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'woocommerce_template_loop_product_link_open', 21 );
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'woocommerce_template_loop_product_link_close', 21 );
//Add additional html around product info elements
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'trackstore_elated_pl_inner_text_additional_tag_before', 5 );
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'trackstore_elated_pl_inner_text_additional_tag_after', 15 );
//Override product title with our own html
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'trackstore_elated_woocommerce_template_loop_product_title', 7 );
//Remove rating stars
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
//Add categories
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'trackstore_elated_woocommerce_shop_loop_categories', 8);
//Change price position
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'trackstore_elated_woo_pl_info_on_image_hover', 'woocommerce_template_loop_price', 12 );
//Remove add to cart
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
/*************** Product Info Position Is Below Image ***************/
//Add additional html tag around product elements
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_inner_additional_tag_after', 21 );
//Add open and close link position
add_action( 'trackstore_elated_woo_pl_info_below_image', 'woocommerce_template_loop_product_link_open', 20 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'woocommerce_template_loop_product_link_close', 20 );
//Add additional html at the end of product info elements
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_text_wrapper_additional_tag_before', 22 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_text_wrapper_additional_tag_after', 30 );
//Add additional html at the top of product info elements
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_text_wrapper_info_top_additional_tag_before', 22);
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_text_wrapper_info_top_additional_tag_after', 26 );
//Override product title with our own html
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_woocommerce_template_loop_product_title', 23 );
//Change price position
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'woocommerce_template_loop_price', 24 );
//Add additional html at the bottom of product info elements
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_text_wrapper_info_bottom_additional_tag_before', 26);
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_text_wrapper_info_bottom_additional_tag_after', 30 );
//Add categories
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_woocommerce_shop_loop_categories', 27);
//Add additional html tags around rating star element
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_rating_additional_tag_before', 28 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_rating_additional_tag_after', 29 );
//Change rating star position
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'woocommerce_template_loop_rating', 28 );
//Add additional html around add to cart element
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_inner_text_additional_tag_before', 1 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_pl_inner_text_additional_tag_after', 3 );
//Change add to cart position
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'trackstore_elated_woo_pl_info_below_image', 'trackstore_elated_woocommerce_template_loop_add_to_cart', 2 );
/*************** PRODUCT LISTS FILTERS - end ***************/
/*************** PRODUCT SINGLE FILTERS - begin ***************/
//Add additional html around single product summary and images
add_action( 'woocommerce_before_single_product_summary', 'trackstore_elated_single_product_content_additional_tag_before', 5 );
add_action( 'woocommerce_after_single_product_summary', 'trackstore_elated_single_product_content_additional_tag_after', 1 );
//Add additional html around single product summary
add_action( 'woocommerce_before_single_product_summary', 'trackstore_elated_single_product_summary_additional_tag_before', 30 );
add_action( 'woocommerce_after_single_product_summary', 'trackstore_elated_single_product_summary_additional_tag_after', 5 );
//Override product single thumbnails with our own html
remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
add_action( 'woocommerce_product_thumbnails', 'trackstore_elated_single_product_show_product_thumbnails', 19 );
//Change sale mark position
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );
add_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_sale_flash', 20 );
add_action('woocommerce_product_thumbnails', 'trackstore_elated_woocommerce_new_product_mark', 20);
//Change title position
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'trackstore_elated_woocommerce_template_single_title', 5 );
//Change price position
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 8 );
//Change product meta position
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 25 );
//Add additional grid html around single product info for wide gallery type
add_action( 'woocommerce_after_single_product_summary', 'trackstore_elated_single_product_wide_additional_tag_before', 8 );
add_action( 'woocommerce_after_single_product_summary', 'trackstore_elated_single_product_wide_additional_tag_after', 30 );
add_action( 'woocommerce_single_product_summary', 'trackstore_elated_single_product_wide_tabs', 35 );
//Add social share (default woocommerce_share)
add_action( 'woocommerce_single_product_summary', 'trackstore_elated_woocommerce_share', 28 );
// remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);
/*************** PRODUCT SINGLE FILTERS - end ***************/
/*************** CART FILTERS - start ***************/
//Add title before cart
add_action( 'woocommerce_before_cart_table', 'trackstore_elated_woocommerce_cart_title', 10);
//Add back to home link after cart
add_action( 'woocommerce_after_cart_table', 'trackstore_elated_woocommerce_cart_back_to_home', 10);
//Add custom empty cart text
remove_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
add_action( 'woocommerce_cart_is_empty', 'trackstore_elated_woocommerce_empty_cart_text', 10);
/*************** CART FILTERS - end ***************/