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
<?php | |
function lp_partner_sort( $query ) { | |
if( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive('partner') ){ | |
if ( isset( $_COOKIE['region'] ) && $_COOKIE['region'] !== '0' ) { | |
// Get the value of the "region" cookie | |
$region = $_COOKIE['region']; | |
// Set the query parameters to filter partners by the corresponding taxonomy term |
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
<?php | |
// Adding notice to product availability text | |
function wdt_extend_availability( $availability, $product ) { | |
$target_shipping_class = 'dropshipping'; | |
if ( $target_shipping_class == $product->get_shipping_class() ) { | |
$availability .= '<p class="shipping-class-notice">Diesen Artikel versenden wir <b>nur innerhalb Deutschlands</b>.</p>'; |
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
<?php | |
function wdt_hide_shipping_when_pickup_required( $rates, $package ) { | |
$class_slug = 'pickup'; | |
// Checking in cart items | |
foreach( WC()->cart->get_cart() as $cart_item ){ | |
// If we find the shipping class | |
if( $cart_item['data']->get_shipping_class() == $class_slug ){ | |
unset($rates['flat_rate:2']); // Remove flat 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
'use strict'; | |
(function($){ | |
let Peekaboo = { | |
// PROPERTIES | |
$window: null, | |
$header: null, | |
height: 0, | |
curPos: 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
<?php | |
function wdt_address_field_validation() { | |
$post_value = $_POST['billing_address_1']; | |
if ( $post_value && ! preg_match( '/[0-9]+/', $post_value ) ) { | |
throw new Exception( sprintf( __( 'Das Feld <strong>Straße</strong> muss eine <strong>Hausnummer</strong> beinhalten.', 'woocommerce' ) ) ); | |
} | |
} |
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
UPDATE wp_users AS user | |
INNER JOIN wp_usermeta AS meta ON meta.user_id = user.ID | |
SET | |
user.user_email = CONCAT(SUBSTRING(MD5(RAND()), -10), "@", SUBSTRING(MD5(RAND()), -10), ".com"), | |
/** random strings */ | |
user.user_pass = CONCAT("pass_", SUBSTRING(MD5(RAND()), -10)), | |
user.user_nicename = CONCAT("nice_", SUBSTRING(MD5(RAND()), -10)), | |
user.user_login = CONCAT("login_", SUBSTRING(MD5(RAND()), -10)), | |
user.display_name = CONCAT("display_", SUBSTRING(MD5(RAND()), -10)) | |
/** except our admins */ |
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
{% set d = ( post.date | date( 'j. F Y' ) ) %} | |
<p> | |
{{ d | replace({ | |
'January': 'Januar', | |
'February': 'Februar', | |
'March': 'März', | |
'May': 'Mai', | |
'June': 'Juni', | |
'July': 'Juli', |
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
<?php | |
add_filter( 'woocommerce_germanized_delivery_time_backorder_html', 'wdt_adjust_delivery_time_html', 10, 4 ); | |
function wdt_adjust_delivery_time_html( $text, $product ) { | |
// this must be a variation if we can find a parent_id | |
if ( $product->get_parent_id() ) { | |
$id = $product->get_parent_id(); | |
} else { | |
$id = $product->get_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
<?php | |
add_action( 'woocommerce_product_options_stock_status', 'wdt_add_deliver_time_fallback' ); | |
function wdt_add_deliver_time_fallback() { | |
// Lieferzeiten aus den Terms generieren | |
$delivery_times = get_terms( array( | |
'taxonomy' => 'product_delivery_time', | |
'hide_empty' => false, | |
) ); | |
$options[''] = __( 'Keine', 'woocommerce'); | |
foreach ($delivery_times as $key => $term) { |
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
<?php | |
add_action( 'woocommerce_process_product_meta', 'wdt_process_delivery_time_fallback', 10, 2 ); | |
function wdt_process_delivery_time_fallback( $id, $post ){ | |
$dtf_id = $_POST['delivery_time_fallback']; | |
if( $dtf_id === '' ) { | |
delete_post_meta( $id, '_delivery_time_fallback' ); | |
} else { | |
update_post_meta( $id, '_delivery_time_fallback', $dtf_id ); | |
} |
NewerOlder