Skip to content

Instantly share code, notes, and snippets.

@twern
twern / gist:03b0d34b4e0411f03bdac70aa7c8773c
Created January 20, 2018 04:36
Theme Hamburg - AP25627
function my_hamburg_best_selling_products($output, $args, $start, $end, $content, $msg) {
$default_meta_query = WC()->query->get_meta_query();
$args = array (
'post_type' => 'product',
'posts_per_page' => 20,
'post_status' => 'publish',
'product_cat' => 'highlights',
'before' => '<div id="teaser-slider" class="flexslider flex-carousel"><ul class="slides">',
@twern
twern / gist:ec68a1cef5115b03f48b2c027d3d57af
Created January 3, 2018 16:27
German Market - Filter - Nebenangaben in den Produkten aus der Mail entfernen entfernen
add_action( 'woocommerce_email_header', 'action_for_remove_tax_from_order_items_in_emails' );
add_action( 'woocommerce_email_footer', 'remove_filter_for_remove_tax_from_order_items_in_emails' );
function action_for_remove_tax_from_order_items_in_emails() {
add_filter( 'woocommerce_order_formatted_line_subtotal', 'remove_tax_from_order_items_in_emails', 10, 3 );
add_filter( 'woocommerce_order_shipping_to_display', 'remove_tax_from_shipping_in_emails', 10, 2 );
}
function remove_filter_for_remove_tax_from_order_items_in_emails() {
remove_filter( 'woocommerce_order_formatted_line_subtotal', 'remove_tax_from_order_items_in_emails', 10, 3 );
@twern
twern / gist:5d851b9938e260abf696c15405226902
Created November 28, 2017 05:42
Hamburg Theme - 22739
<?php
/**
* Content wrappers.
*
* @package Hamburg
* @subpackage Templates/WooCommerce
* @template-version 1.6.4
*/
?>
<div class="site-main">
@twern
twern / gist:1176f3728abfbabd575d3f8c5cdd1abe
Created November 3, 2017 16:44
German Market - 20239
add_filter( 'gm_delivery_time_message_if_out_of_stock', 'my_gm_delivery_time_message_if_out_of_stock', 10, 2 );
function my_gm_delivery_time_message_if_out_of_stock( $message, $product ) {
if ( is_shop() || is_product_category() ) {
$message = '<p class="stock out-of-stock">Nicht lieferbar</p>';
}
return $message;
}
add_filter( 'woocommerce_single_product_summary', 'show_rbp_price_of_different_group', 10 );
function show_rbp_price_of_different_group() {
// nur wenn der user nicht eingeloggt ist
if ( ! is_user_logged_in() ) {
// init
global $product;
$price = $product->get_price();
remove_action( 'woocommerce_after_shop_loop_item_title', array( 'WGM_Template', 'woocommerce_de_price_with_tax_hint_loop' ), 5 );
add_action ('woocommerce_after_shop_loop_item_title', array( 'WGM_Template', 'woocommerce_de_price_with_tax_hint_loop' ), 20 );
add_filter( 'wgm_product_summary_parts', 'my_wgm_product_summary_parts', 10, 3 );
function my_wgm_product_summary_parts( $output_parts, $product, $hook ) {
if ( $hook == 'loop' ) {
if ( isset( $output_parts[ 'price' ] ) ) {
unset( $output_parts[ 'price' ] );
}
<?php
/**
* The template for displaying product content in the single-product.php template
*
* This template can be overridden by copying it to yourtheme/woocommerce/content-single-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
@twern
twern / gist:11ae57625825447466fb147749872a53
Created September 12, 2017 07:50
German Market - Filter Polylang Lieferzeit
// Fix problem with polylang for delivery times of German Market
add_filter( 'woocommerce_de_get_deliverytime_string_label_string', 'my_woocommerce_de_get_deliverytime_string_label_string' );
function my_woocommerce_de_get_deliverytime_string_label_string( $product ) {
$term_id = WGM_Template::get_term_id_from_product_meta( '_lieferzeit', $product );
if ( (int) $term_id == - 1 || empty( $term_id ) ) {
$term_id = get_option( WGM_Helper::get_wgm_option( 'global_lieferzeit' ) );
}
@twern
twern / gist:252b13547988aed8357d307267dfde4a
Created August 8, 2017 07:09
German Market - Filter - Versandanzeige
add_filter( 'woocommerce_de_free_shipping_string', 'my_woocommerce_de_free_shipping_string' );
function my_woocommerce_de_free_shipping_string( $string ) {
return 'Kostenloser Versand innerhalb Deutschland';
}