This file contains 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
/** | |
* Produkte einer bestimmten Kategorie von der Shop Seite entfernen | |
*/ | |
function custom_pre_get_posts_query( $q ) { | |
$tax_query = (array) $q->get( 'tax_query' ); | |
$tax_query[] = array( | |
'taxonomy' => 'product_cat', | |
'field' => 'slug', |
This file contains 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
/** | |
* Weiterleitung direkt zur WooCommerce Kasse | |
*/ | |
function my_custom_add_to_cart_redirect( $url ) { | |
$url = WC()->cart->get_checkout_url(); | |
// $url = wc_get_checkout_url(); // seit WooCommerce 2.5 return $url; | |
} | |
add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' ); |
This file contains 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
/** | |
* Enfernt die WooCommerce Standardsorierung von der Shopseite. | |
*/ | |
add_action( 'after_setup_theme', 'remove_woocommerce_catalog_ordering', 1 ); | |
function remove_woocommerce_catalog_ordering() { | |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); // Bei Theme Storefront, 30 mit 10 autauschen. | |
} |
This file contains 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 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
/** | |
* Produkt automatisch in den Warenkorb | |
*/ | |
add_action( 'template_redirect', 'add_product_to_cart' ); | |
function add_product_to_cart() { | |
if ( ! is_admin() ) { | |
$product_id = 320; //Die ID mit der richtigen Produkt ID austauschen | |
$found = false; | |
//check if product already in cart | |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) { |
This file contains 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
// ID mit ID des Produktes austauschen | |
[add_to_cart_url id=ID] |
This file contains 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 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 wpa104537_filter_products_by_featured_status() { | |
global $typenow, $wp_query; | |
if ($typenow=='product') : | |
// Featured/ Not Featured | |
$output .= "<select name='featured_status' id='dropdown_featured_status'>"; | |
$output .= '<option value="">'.__( 'Show All Featured Statuses', 'woocommerce' ).'</option>'; |
This file contains 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
/* | |
* Anzahl der verkauften Produkte in der WooCommerce Produktbeschreibung anzeigen | |
* | |
*/ | |
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 ); | |
function wc_product_sold_count() { global $product; | |
$units_sold = get_post_meta( $product->id, 'total_sales', true ); | |
echo '<p>' . sprintf( __( 'Verkaufte Produkte: %s', 'woocommerce' ) | |
, $units_sold ) . '</p>'; } |