<?php
/**
 * Mezze Pro WooCoommerce compatibility hooks.
 *
 * This is the template that includes all WooCoommerce hooks to make the theme compatible with WooCommerce.
 *
 * @package Theme Palace
 * @subpackage Mezze Pro
 * @since Mezze Pro 1.0.0
 */

remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' ,10 );
remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' ,10 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb' ,20 );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );

function mezze_before_main_content() {
	echo '<div id="inner-content-wrapper" class="wrapper page-section">';
}
add_action( 'woocommerce_before_main_content', 'mezze_before_main_content', 5 );

function mezze_after_main_content() {
	echo '</div>';
}
add_action( 'woocommerce_sidebar', 'mezze_after_main_content', 20 );

// Change number or products per row to 3
add_filter('loop_shop_columns', 'mezze_loop_columns');
if ( ! function_exists('mezze_loop_columns')) {
	/**
	 * Shop Page no. of column
	 *
	 * @since Mezze 1.0
	 *
	 */
	function mezze_loop_columns() {
		return 3; // 3 products per row
	}
}

// remove title
add_filter('woocommerce_show_page_title', 'mezze_hide_title' );
function mezze_hide_title() {
	return false;
}

add_action( 'woocommerce_after_main_content', 'mezze_shop_sidebar', 15 );
if ( ! function_exists( 'mezze_shop_sidebar' ) ) {
	function mezze_shop_sidebar() {
		if ( mezze_is_sidebar_enable() ) {
			get_sidebar();
		}
	}
}