I'm working with WooCommerce and I'm changing some functionalities in my home page.
My theme uses "Woocommerce Hooks" but I only see where calls the function. What I need is to find that function and change it.
In my case I saw that the code I want to change is in "/plugin/component/wc_product.php" and there I see this piece of code:
<ul class="products">
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
<?php if( "default" == $tpvc_wc_product_style ) : ?>
<?php wc_get_template_part( 'content-product' ); ?>
<?php else : ?>
<?php wc_get_template_part( 'content-product', 'alt' ); ?>
<?php endif; ?>
<?php endwhile; // end of the loop. ?>
</ul>
But when I go to "/theme/woocommerce/content-product.php" I only see this code:
<li <?php post_class(); ?>>
<div class="product-inner">
<?php
/**
* woocommerce_before_shop_loop_item hook.
*
* #hooked woocommerce_template_loop_product_link_open - 10
*/
do_action( 'woocommerce_before_shop_loop_item' );
/**
* woocommerce_before_shop_loop_item_title hook.
*
* #hooked woocommerce_show_product_loop_sale_flash - 10
* #hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action( 'woocommerce_before_shop_loop_item_title' );
/**
* woocommerce_shop_loop_item_title hook.
*
* #hooked woocommerce_template_loop_product_title - 10
*/
do_action( 'woocommerce_shop_loop_item_title' );
/**
* woocommerce_after_shop_loop_item_title hook.
*
* #hooked woocommerce_template_loop_rating - 5
* #hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
/**
* woocommerce_after_shop_loop_item hook.
*
* #hooked woocommerce_template_loop_product_link_close - 5
* #hooked woocommerce_template_loop_add_to_cart - 10
*/
do_action( 'woocommerce_after_shop_loop_item' );
?>
</div>
</li>
Where are Woocommerce Hooks functions deployed? Where are that do_action() functions so I can edit them?
Thanks for your help!
Related
Got stucked. I need to insert a code in theme quick view - the action is : do_action( 'iworks_omnibus_wc_lowest_price_message' );
THE CODE IS:
<?php
/**
* Display product quickview.
*
* #package Razzi
* #version 1.0.0
*/
use Razzi\Helper;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $product;
$classes = wc_get_product_class( '', $product );
if ( Helper::get_option( 'product_add_to_cart_ajax' ) ) {
$classes[] = 'product-add-to-cart-ajax';
}
if ( get_option( 'rz_buy_now' ) == 'yes' ) {
$classes[] = 'has-buy-now';
}
$classes[] = 'product-is-quickview';
do_action('woocommerce_before_single_product');
?>
<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<div class="entry-thumbnail">
<?php
/**
* Hook: razzi_woocommerce_product_quickview_thumbnail
*
* #hooked woocommerce_show_product_sale_flash - 5
* #hooked woocommerce_show_product_images - 10
* #hooked product_quick_view_more_info_button - 15
*
*/
do_action( 'razzi_woocommerce_product_quickview_thumbnail' );
?>
</div>
<div class="summary entry-summary razzi-scrollbar">
<?php
/**
* Hook: razzi_woocommerce_product_quickview_summary
*
* #hooked woocommerce_template_single_rating - 10
* #hooked woocommerce_template_single_title - 20
* #hooked open_price_box_wrapper - 30
* #hooked woocommerce_template_single_price - 40
* #hooked product_availability - 50
* #hooked close_price_box_wrapper - 60
* #hooked woocommerce_template_single_excerpt - 70
* #hooked woocommerce_template_single_add_to_cart - 80
* #hooked woocommerce_template_single_meta - 90
*
*/
do_action( 'razzi_woocommerce_product_quickview_summary' );
?>
</div>
</div>
<?php
and
<?php
/**
* WooCommerce Quick View template hooks.
*
* #package Razzi
*/
namespace Razzi\WooCommerce\Modules;
use Razzi\Helper;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Class of Product Quick View
*/
class Quick_View {
/**
* Instance
*
* #var $instance
*/
protected static $instance = null;
/**
* Initiator
*
* #since 1.0.0
* #return object
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Instantiate the object.
*
* #since 1.0.0
*
* #return void
*/
public function __construct() {
// Quick view modal.
add_action( 'wc_ajax_product_quick_view', array( $this, 'quick_view' ) );
add_action( 'razzi_woocommerce_product_quickview_thumbnail', 'woocommerce_show_product_images', 10 );
add_action( 'razzi_woocommerce_product_quickview_thumbnail', array(
$this,
'product_quick_view_more_info_button'
) );
add_action( 'razzi_woocommerce_product_quickview_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'razzi_woocommerce_product_quickview_summary', 'woocommerce_template_single_title', 20 );
add_action( 'razzi_woocommerce_product_quickview_summary', array(
$this,
'open_price_box_wrapper'
), 30 );
if ( apply_filters( 'razzi_product_show_price', true ) ) {
add_action( 'razzi_woocommerce_product_quickview_summary', 'woocommerce_template_single_price', 40 );
}
add_action( 'razzi_woocommerce_product_quickview_summary', array(
\Razzi\WooCommerce\Helper::instance(),
'product_availability'
), 50 );
add_action( 'razzi_woocommerce_product_quickview_summary', array(
$this,
'close_price_box_wrapper'
), 60 );
add_action( 'razzi_woocommerce_product_quickview_summary', 'woocommerce_template_single_excerpt', 70 );
add_action( 'razzi_woocommerce_product_quickview_summary', 'woocommerce_template_single_add_to_cart', 80 );
add_action( 'razzi_woocommerce_product_quickview_summary', 'woocommerce_template_single_meta', 90 );
add_action( 'wp_footer', array( $this, 'quick_view_modal' ), 40 );
}
/**
* Open button wrapper
*
* #since 1.0.0
*
* #return void
*/
public function open_price_box_wrapper() {
echo '<div class="summary-price-box">';
}
/**
* Close button wrapper
*
* #since 1.0.0
*
* #return void
*/
public function close_price_box_wrapper() {
echo '</div>';
}
/**
* Product quick view template.
*
* #since 1.0.0
*
* #return void
*/
public function quick_view() {
if ( empty( $_POST['product_id'] ) ) {
wp_send_json_error( esc_html__( 'No product.', 'razzi' ) );
exit;
}
$post_object = get_post( $_POST['product_id'] );
if ( ! $post_object || ! in_array( $post_object->post_type, array(
'product',
'product_variation',
true
) ) ) {
wp_send_json_error( esc_html__( 'Invalid product.', 'razzi' ) );
exit;
}
$GLOBALS['post'] = $post_object;
wc_setup_product_data( $post_object );
ob_start();
wc_get_template( 'content-product-quickview.php', array(
'post_object' => $post_object,
) );
wp_reset_postdata();
wc_setup_product_data( $GLOBALS['post'] );
$output = ob_get_clean();
wp_send_json_success( $output );
exit;
}
/**
* Quick view modal.
*
* #since 1.0.0
*
* #return void
*/
public function quick_view_modal() {
if( Helper::is_cartflows_template() ) {
return;
}
$featured_icons = (array) Helper::get_option( 'product_loop_featured_icons' );
if ( ! in_array( 'qview', $featured_icons ) ) {
return;
}
?>
<div id="quick-view-modal" class="quick-view-modal rz-modal single-product">
<div class="off-modal-layer"></div>
<div class="modal-content container woocommerce">
<div class="button-close active">
<?php echo \Razzi\Icon::get_svg( 'close' ) ?>
</div>
<div class="product"></div>
</div>
<div class="razzi-posts__loading">
<div class="razzi-loading"></div>
</div>
</div>
<?php
}
/**
* Quick view more info button
*
* #since 1.0.0
*
* #return void
*/
public function product_quick_view_more_info_button() {
printf(
'<a href="%s" class="product-more-infor">
<span class="product-more-infor__text">%s</span>%s
</a>',
is_customize_preview() ? '#' : esc_url( get_permalink() ),
apply_filters( 'product_quick_view_more_infor_text', esc_html__( 'More Product Info', 'razzi' ) ),
\Razzi\Icon::get_svg( 'infor', '', 'shop' )
);
}
}
Got many errors making customizations on that. Thanks in advance.
I was trying to show omnibus price from the plugin called Omnibus — show the lowest price by Marcin Pietrzak in the theme quick view.
I want to remove the product loop on some archive pages.
In my case if the current archive is a vendor archive. But I guess the why isn't too important.
At the moment I'm using a custom archive-product.php.
I added and if/else condition around this part of the template code:
if ( woocommerce_product_loop() ) {
/**
* Hook: woocommerce_before_shop_loop.
*
* #hooked woocommerce_output_all_notices - 10
* #hooked woocommerce_result_count - 20
* #hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();
if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
/**
* Hook: woocommerce_shop_loop.
*/
do_action( 'woocommerce_shop_loop' );
wc_get_template_part( 'content', 'product' );
}
}
woocommerce_product_loop_end();
/**
* Hook: woocommerce_after_shop_loop.
*
* #hooked woocommerce_pagination - 10
*/
do_action( 'woocommerce_after_shop_loop' );
} else {
/**
* Hook: woocommerce_no_products_found.
*
* #hooked wc_no_products_found - 10
*/
do_action( 'woocommerce_no_products_found' );
}
It works but I had to edit the theme file.
I saw that there is an if/else for the loop itself:
if ( woocommerce_product_loop() ) {
Can I hook this part to disable the loop without touching the archive-product.php?
Im using Woocomerce and some fields are being added automatically. I want to remove some of this, but, when I'm editing the template, I can't figure out what function or part of the code I need edit, I will post an image from the email:
I want just the Tracking Number and Date Shipped and I want to REMOVE Status, Provider, Tracking Link
And this is the code of template:
<?php
/**
* Customer completed order email
*
* This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-completed-order.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* #see https://docs.woocommerce.com/document/template-structure/
* #package WooCommerce/Templates/Emails
* #version 3.7.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*
* #hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s: Customer first name */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
<?php /* translators: %s: Site title */ ?>
<p><?php esc_html_e( 'We have finished processing your order.', 'woocommerce' ); ?></p>
<?php
/*
* #hooked WC_Emails::order_details() Shows the order details table.
* #hooked WC_Structured_Data::generate_order_data() Generates structured data.
* #hooked WC_Structured_Data::output_structured_data() Outputs structured data.
* #since 2.5.0
*/
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
/*
* #hooked WC_Emails::order_meta() Shows order meta data.
*/
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
/*
* #hooked WC_Emails::customer_details() Shows customer details
* #hooked WC_Emails::email_address() Shows email address
*/
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* Show user-defined additional content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/*
* #hooked WC_Emails::email_footer() Output the email footer
*/
do_action( 'woocommerce_email_footer', $email );
After some work, i figure out this solution:
foreach ($order->get_items() as $item) {
$item->delete_meta_data('Provider');
$item->delete_meta_data('Tracking Link');
}
Works
I want to make couple of unique classes, like class1, class2 up to 6 or 7 added to 6 or 7 products in the shop loop.
I'd like to make these 6/7 products with unique class doubled to make it 12/14 products on the page in shop catalague.
I tried editing content-product.php file and archive-page.php.
I added this code to content product file:
<?php
$x = 1;
?>
<li class="columns class<?php echo esc_attr($x++); ?>">
But it does not add any extra number to another product.
It only add +1 if there is another div class inside that li with this php code:
<?php echo esc_attr($x++); ?>">
added to the class, but it does not apply to another li with the next product.
Any ideas how to achieve that?
Ok I found the solution.
<?php
$x = 1;
?>
<li class="columns class<?php echo esc_attr($x++); ?>">
this code only works within one file of php so I needed to keep everything in one php file,
exactly in archive-product.php
Instead of keeping this reference to another php file
<?php wc_get_template_part( 'content', 'product' ); ?>
I took all the content from the content product and added it in archive-product.php
so $x code could work.
That's how the code of archive-product.php looks like and it works perfectly:
defined( 'ABSPATH' ) || exit;
get_header( 'shop' );
do_action( 'woocommerce_before_main_content' );
?>
<header class="woocommerce-products-header">
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
<h1 class="woocommerce-products-header__title page-title"><?php
woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php
/**
* Hook: woocommerce_archive_description.
*
* #hooked woocommerce_taxonomy_archive_description - 10
* #hooked woocommerce_product_archive_description - 10
*/
do_action( 'woocommerce_archive_description' );
?>
</header>
<?php
if ( woocommerce_product_loop() ) {
/**
* Hook: woocommerce_before_shop_loop.
*
* #hooked woocommerce_output_all_notices - 10
* #hooked woocommerce_result_count - 20
* #hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
}
?>
<div class="products">
<?php
$one = 1;
$args = array(
'post_type' => 'product',
'posts_per_page' => 12
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="columns product<?php echo esc_attr($one++); ?>">
<div class="column is-one-third">
<?php
defined( 'ABSPATH' ) || exit;
global $product;
// Ensure visibility.
if ( empty( $product ) || ! $product->is_visible() ) {
return;
}
/**
* Hook: woocommerce_before_shop_loop_item.
*
* #hooked woocommerce_template_loop_product_link_open - 10
*/
do_action( 'woocommerce_before_shop_loop_item' );
/**
* Hook: woocommerce_before_shop_loop_item_title.
*
* #hooked woocommerce_show_product_loop_sale_flash - 10
* #hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action( 'woocommerce_before_shop_loop_item_title' );
/**
*
* close link
*/
do_action( 'woocommerce_shop_loop_close_link' );
?>
</div>
<div class="column">
<?php
/**
* Hook: woocommerce_before_shop_loop_item.
*
* #hooked woocommerce_template_loop_product_link_open - 10
*/
do_action( 'woocommerce_before_shop_loop_item' );
/**
* Hook: woocommerce_shop_loop_item_title.
*
* #hooked woocommerce_template_loop_product_title - 10
*/
do_action( 'woocommerce_shop_loop_item_title' );
/**
* Hook: woocommerce_after_shop_loop_item_title.
*
* #hooked woocommerce_template_loop_rating - 5
* #hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
/**
* Hook: woocommerce_after_shop_loop_item.
*
* #hooked add to cart
*/
do_action( 'woocommerce_after_shop_loop_item' );
/**
*
* close link
*/
do_action( 'woocommerce_shop_loop_close_link' );
?>
</div>
</div>
<?php
endwhile;
} else {
echo __( 'Nie znaleziono produktów' );
}
wp_reset_postdata();
?>
</div><!--/.products-->
<?php
do_action( 'woocommerce_after_shop_loop' );
get_footer( 'shop' );
Actually my final awnser is a bit different.
Previous one did not work with select/options for order by and probably for more than that. The proper solution for archive-page.php is:
defined( 'ABSPATH' ) || exit;
get_header( 'shop' );
/**
* Hook: woocommerce_before_main_content.
*
* #hooked woocommerce_output_content_wrapper - 10 (outputs opening
divs for the content)
* #hooked woocommerce_breadcrumb - 20
* #hooked WC_Structured_Data::generate_website_data() - 30
*/
do_action( 'woocommerce_before_main_content' );
?>
<header class="woocommerce-products-header">
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php
/**
* Hook: woocommerce_archive_description.
*
* #hooked woocommerce_taxonomy_archive_description - 10
* #hooked woocommerce_product_archive_description - 10
*/
do_action( 'woocommerce_archive_description' );
?>
</header>
<?php
woocommerce_product_loop_start();
$one = 1;
if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
?>
<div class="columns product<?php echo esc_attr($one++); ?>">
<?php
/**
* Hook: woocommerce_shop_loop.
*
* #hooked WC_Structured_Data::generate_product_data() - 10
*/
do_action( 'woocommerce_shop_loop' );
wc_get_template_part( 'content', 'product' );
}
}
woocommerce_product_loop_end();
?>
</div>
<?php
/**
* Hook: woocommerce_after_shop_loop.
*
* #hooked woocommerce_pagination - 10
*/
do_action( 'woocommerce_after_shop_loop' );
} else {
/**
* Hook: woocommerce_no_products_found.
*
* #hooked wc_no_products_found - 10
*/
do_action( 'woocommerce_no_products_found' );
}
/**
* Hook: woocommerce_after_main_content.
*
* #hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the
content)
*/
do_action( 'woocommerce_after_main_content' );
/**
* Hook: woocommerce_sidebar.
*
* #hooked woocommerce_get_sidebar - 10
*/
do_action( 'woocommerce_sidebar' );
get_footer( 'shop' );
In my category page WooCommerce there is showing 20 products in listing.
I want to increase the products listing to 40 and add a div after 20 products for add.
Can anyone please help.
Here is my archive-product.php code
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
get_header( 'shop' ); ?>
<?php
/**
* woocommerce_before_main_content hook.
*
* #hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* #hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );
?>
<?php if ( apply_filters( 'woocommerce_show_page_title', false ) ) : ?>
<h1 class="page-title" style="display:none;"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php
/**
* woocommerce_archive_description hook.
*
* #hooked woocommerce_taxonomy_archive_description - 10
* #hooked woocommerce_product_archive_description - 10
*/
do_action( 'woocommerce_archive_description' );
?>
<?php if ( have_posts() ) : ?>
<?php
/**
* woocommerce_before_shop_loop hook.
*
* #hooked woocommerce_result_count - 20
* #hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="content-box">
<?php woocommerce_product_loop_start(); ?>
<?php woocommerce_product_subcategories(); ?>
<?php while ( have_posts() ) : the_post();
?>
<?php if ( is_search() ) { ?>
<?php wc_get_template_part( 'content', 'search' ); ?>
<?php }else{ ?>
<?php wc_get_template_part( 'content', 'product' );
}
?>
<?php endwhile; // end of the loop.
?>
<?php woocommerce_product_loop_end(); ?>
</div></div>
<?php
/**
* woocommerce_after_shop_loop hook.
*
* #hooked woocommerce_pagination - 10
*/
do_action( 'woocommerce_after_shop_loop' );
?>
<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
<?php wc_get_template( 'loop/no-products-found.php' ); ?>
<?php endif; ?>
<?php
/**
* woocommerce_after_main_content hook.
*
* #hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
*/
do_action( 'woocommerce_after_main_content' );
?>
<?php
/**
* woocommerce_sidebar hook.
*
* #hooked woocommerce_get_sidebar - 10
*/
do_action( 'woocommerce_sidebar' );
?>
Here is my content-product.php code
<?php
/**
* The template for displaying product content within loops
*
* This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* #see https://docs.woocommerce.com/document/template-structure/
* #author WooThemes
* #package WooCommerce/Templates
* #version 2.6.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $product;
// Ensure visibility
if ( empty( $product ) || ! $product->is_visible() ) {
return;
}
?>
<?php
/**
* woocommerce_before_shop_loop_item hook.
*
* #hooked woocommerce_template_loop_product_link_open - 10
*/
do_action( 'woocommerce_before_shop_loop_item' );
/**
* woocommerce_before_shop_loop_item_title hook.
*
* #hooked woocommerce_show_product_loop_sale_flash - 10
* #hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action( 'woocommerce_before_shop_loop_item_title' );
/**
* woocommerce_shop_loop_item_title hook.
*
* #hooked woocommerce_template_loop_product_title - 10
*/
//do_action( 'woocommerce_shop_loop_item_title' );?>
<tr <?php post_class(); ?>>
<td class="slno">
</td>
<td><?php do_action( 'woocommerce_shop_loop_item_title' ); ?></td>
<td class="des">
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
?>
Add this in function.php of your theme or in your custom plugin to increase the products per page:
add_filter('loop_shop_per_page', create_function('$cols', 'return 40;'), 20);
Here is the sample for "\wp-content\plugins\woocommerce\templates\archive-product.php" if you edit direct core or else if you override it by copying the templates directory into the current theme directory the path will be "\mytheme\woocommerce\archive-product.php"
Please check the content for archive-product.php exactly just above and below the while ( have_posts() ) : the_post();
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* #see https://docs.woocommerce.com/document/template-structure/
* #author WooThemes
* #package WooCommerce/Templates
* #version 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
get_header( 'shop' ); ?>
<?php
/**
* woocommerce_before_main_content hook.
*
* #hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* #hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );
?>
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php
/**
* woocommerce_archive_description hook.
*
* #hooked woocommerce_taxonomy_archive_description - 10
* #hooked woocommerce_product_archive_description - 10
*/
do_action( 'woocommerce_archive_description' );
?>
<?php if ( have_posts() ) : ?>
<?php
/**
* woocommerce_before_shop_loop hook.
*
* #hooked woocommerce_result_count - 20
* #hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
?>
<?php woocommerce_product_loop_start(); ?>
<?php woocommerce_product_subcategories(); ?>
<?php $productIndex = 0; $addDivAt = 20 ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php $productIndex++; ?>
<?php if($productIndex == $addDivAt): ?>
<div>TRUE</div>
<?php endif; ?>
<?php endwhile; // end of the loop. ?>
<?php woocommerce_product_loop_end(); ?>
<?php
/**
* woocommerce_after_shop_loop hook.
*
* #hooked woocommerce_pagination - 10
*/
do_action( 'woocommerce_after_shop_loop' );
?>
<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
<?php wc_get_template( 'loop/no-products-found.php' ); ?>
<?php endif; ?>
<?php
/**
* woocommerce_after_main_content hook.
*
* #hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
*/
do_action( 'woocommerce_after_main_content' );
?>
<?php
/**
* woocommerce_sidebar hook.
*
* #hooked woocommerce_get_sidebar - 10
*/
do_action( 'woocommerce_sidebar' );
?>