Last active
July 5, 2018 04:43
-
-
Save dasbairagya/966d4abb76ae1d4688a5a52c2f01c613 to your computer and use it in GitHub Desktop.
Woocommerce shop shop details page customizations using hook:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* woocommerce customization*/ | |
| add_filter( 'woocommerce_show_page_title' , 'woo_hide_page_title' ); | |
| function woo_hide_page_title() { | |
| return false; | |
| } | |
| remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); | |
| //remove the sale flush | |
| remove_action('woocommerce_before_shop_loop_item_title','woocommerce_show_product_loop_sale_flash',10); | |
| //add the custom icon div after thumbnail | |
| // add_action('woocommerce_before_shop_loop_item_title','icon_view_link',10); | |
| // function icon_view_link(){ | |
| // echo '<span class="icon-view"> | |
| // <strong><i class="fa fa-link"></i></strong> | |
| // </span>'; | |
| // } | |
| //add cuatom class to the product link open | |
| remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); | |
| add_action( 'woocommerce_before_shop_loop_item', 'mycode_template_loop_product_link_open', 10 ); | |
| function mycode_template_loop_product_link_open() { | |
| echo '<a href="' . get_the_permalink() . '" rel="nofollow" class="woocommerce-LoopProduct-link woocommerce-loop-product__link media-link">'; | |
| } | |
| //close the product link | |
| add_action( 'woocommerce_before_shop_loop_item_title', 'mycode_template_loop_product_link_close', 10 ); | |
| function mycode_template_loop_product_link_close() { | |
| echo '</a>'; | |
| } | |
| //add custom produact title | |
| remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10); | |
| add_action('woocommerce_shop_loop_item_title','mycustom_product_title',10); | |
| function mycustom_product_title() { | |
| echo'<h4 class="caption-title">'.get_the_title().'</h4>'; | |
| } | |
| //customize the add to cart button | |
| // remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart',10); | |
| add_action('woocommerce_after_shop_loop_item','add_to_cart_wraper_open',10); | |
| function add_to_cart_wraper_open(){ | |
| echo '<div class="buttons">'; | |
| } | |
| //for additional class entry pls go the the woocommer>loop>add-to-cart.php | |
| // add_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart',10); | |
| add_action('woocommerce_after_shop_loop_item','add_to_cart_wraper_close',11); | |
| function add_to_cart_wraper_close(){ | |
| echo '</div>'; | |
| } | |
| //@hook to show the related product | |
| add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); | |
| //@hook for product description heading | |
| add_filter( 'woocommerce_product_description_heading', 'isa_product_description_heading' ); | |
| function isa_product_description_heading() { | |
| return 'Product Specification'; | |
| } | |
| //@hook detail page remove sale flush | |
| remove_action('woocommerce_before_single_product_summary','woocommerce_show_product_sale_flash',10); | |
| //remove short description | |
| remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); | |
| //print hr | |
| add_action('woocommerce_product_meta_start','print_hr',40); | |
| function print_hr(){ | |
| echo '<hr />'; | |
| } | |
| add_action('woocommerce_product_meta_end','print_hr',40); | |
| //add short description | |
| add_action('woocommerce_product_meta_start','woocommerce_template_single_excerpt',40); | |
| //remove data tabs from the bottom | |
| // remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); | |
| // add data tabs just below the add to cart | |
| // add_action( 'woocommerce_product_meta_end', 'woocommerce_output_product_data_tabs', 40 ); | |
| add_action('woocommerce_single_product_summary','print_hr',50); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment