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
add_filter( 'woocommerce_product_data_store_cpt_get_products_query', 'handle_price_range_query_var', 10, 2 ); | |
function handle_price_range_query_var( $query, $query_vars ) { | |
if ( ! empty( $query_vars['price_range'] ) ) { | |
$price_range = explode( '|', esc_attr($query_vars['price_range']) ); | |
if ( is_array($price_range) && count($price_range) == 2 ) { | |
$query['meta_query']['relation'] = 'AND'; | |
$query['meta_query'][] = array( | |
'key' => '_price', |
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
function get_filtered_price() { | |
global $wpdb; | |
$args = wc()->query->get_main_query(); | |
$tax_query = isset( $args->tax_query->queries ) ? $args->tax_query->queries : array(); | |
$meta_query = isset( $args->query_vars['meta_query'] ) ? $args->query_vars['meta_query'] : array(); | |
foreach ( $meta_query + $tax_query as $key => $query ) { | |
if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) { |
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
<form role="search" method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/' ) ); ?>"> | |
<label class="screen-reader-text" for="s"><?php _e( 'Search for:', 'woocommerce' ); ?></label> | |
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search Products…', 'placeholder', 'woocommerce' ); ?>" value="<?php echo get_search_query(); ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label', 'woocommerce' ); ?>" /> | |
<input type="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'woocommerce' ); ?>" /> | |
<input type="hidden" name="post_type" value="product" /> | |
</form> |
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
/** | |
* Check if WooCommerce is activated | |
*/ | |
if ( ! function_exists( 'is_woocommerce_activated' ) ) { | |
function is_woocommerce_activated() { | |
if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; } | |
} | |
} |
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
/** | |
* Hide shipping rates when free shipping is available, but keep "Local pickup" | |
* Updated to support WooCommerce 2.6 Shipping Zones | |
*/ | |
function hide_shipping_when_free_is_available( $rates, $package ) { | |
$new_rates = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
// Only modify rates if free_shipping is present. | |
if ( 'free_shipping' === $rate->method_id ) { |
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
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
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 | |
/** | |
* Copy from here to your (child) themes functions.php | |
* Recommended to do so via FTP. | |
*/ | |
/** | |
* Hide all but the free shipping options when free is available. | |
* |
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 | |
/** | |
* | |
* Add only for parents coustom term Options | |
* @author rene reimann | |
* @home http://www.rene-reimann.de | |
* | |
* @hook category_add_form_fields Hooks into the category edit page | |
* @hook edit_tag_form_fields Hooks into the category frontpage |