<?php
/**
 * WooCommerce
 * @author      CodeGearThemes
 * @category    WordPress
 * @package     Acoustics
 * @version     1.0.0
 */

function acoustics_woocommerce_page_sidebar() {

	global $post;

	if ( !isset( $post ) ) {
		return;
	}

	if( is_cart() || is_checkout() || is_account_page() ){
		add_filter( 'acoustics_sidebar_enable', '__return_false' );
		add_filter( 'acoustics_content_class', function() { return 'one-whole no-sidebar'; } );
	}
}
add_action( 'wp', 'acoustics_woocommerce_page_sidebar', 10 );


if ( function_exists( 'acoustics_woocommerce_header_cart' ) ):
	add_action( 'acoustics_navigation', 'acoustics_woocommerce_header_cart', 10 );
endif;

remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs' );
add_action( 'woocommerce_after_single_product', 'woocommerce_output_product_data_tabs' );

add_action( 'woocommerce_after_quantity_input_field', 'acoustics_product_quantity_start', 10);
function acoustics_product_quantity_start(){ ?>
	<button type="button" class="plus" name="plus">
		<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"  width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-plus">
			<line x1="12" y1="5" x2="12" y2="19"/>
			<line x1="5" y1="12" x2="19" y2="12"/>
		</svg>
	</button>
<?php
}

add_action( 'woocommerce_before_quantity_input_field', 'acoustics_product_quantity_end', 10);
function acoustics_product_quantity_end(){ ?>
	<button type="button" class="minus" name="minus">
		<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-minus">
			<line x1="5" y1="12" x2="19" y2="12"/>
		</svg>
	</button>
<?php
}

/**
 * Filter single product Flexslider options
 */
function acoustics_product_carousel_options( $options ) {

	$options['directionNav'] = true;
	$options['controlNav'] = 'thumbnails';

	return $options;
}
add_filter( 'woocommerce_single_product_carousel_options', 'acoustics_product_carousel_options' );
