Skip to content

Instantly share code, notes, and snippets.

Avatar

Tino Werner twern

  • Germany
View GitHub Profile
View gist:03b0d34b4e0411f03bdac70aa7c8773c
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 Jan 3, 2018
German Market - Filter - Nebenangaben in den Produkten aus der Mail entfernen entfernen
View gist:ec68a1cef5115b03f48b2c027d3d57af
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 );
View gist:5d851b9938e260abf696c15405226902
<?php
/**
* Content wrappers.
*
* @package Hamburg
* @subpackage Templates/WooCommerce
* @template-version 1.6.4
*/
?>
<div class="site-main">
View gist:1176f3728abfbabd575d3f8c5cdd1abe
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;
}
View gist:bd255689e72e6e7dd3bd58d25dd0a69d
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();
View gist:9d3c335dbde10e2ccd0cb761cac99760
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' ] );
}
View gist:66d5ee6d36ebf1077c51dd919d08d602
<?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 Sep 12, 2017
German Market - Filter Polylang Lieferzeit
View gist:11ae57625825447466fb147749872a53
// 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 Aug 8, 2017
German Market - Filter - Versandanzeige
View gist:252b13547988aed8357d307267dfde4a
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';
}
You can’t perform that action at this time.