Skip to content

Instantly share code, notes, and snippets.

View rwkyyy's full-sized avatar
🏠
Working from home

Eduard “RwkY” Doloc rwkyyy

🏠
Working from home
View GitHub Profile
@rwkyyy
rwkyyy / gist:0a7e6a3fd39a5ad640f190164d699e91
Created August 2, 2018 14:57
Redirect WooCommerce for non-logged-in
function rwk_redirect_b2b() {
if (
! is_user_logged_in()
&& (is_woocommerce() || is_cart() || is_checkout())
) {
// feel free to customize the following line
wp_redirect( site_url('autentificare/') )
exit;
}
}
@rwkyyy
rwkyyy / gist:ed5386b829a9aa6849aca1f452df10b4
Created June 13, 2018 12:38
send canceled order mail to client - woocommerce
/*
* Add customer email to Cancelled Order recipient list
*/
function wc_cancelled_order_add_customer_email( $recipient, $order ){
return $recipient . ',' . $order->billing_email;
}
add_filter( 'woocommerce_email_recipient_cancelled_order', 'wc_cancelled_order_add_customer_email', 10, 2 );
@rwkyyy
rwkyyy / gist:d3552815ecefde3aeb93c1f0a0953f34
Created May 30, 2018 13:00
WooCommerce - Add static content after product title
function add_after_product_title_rwk() {?>
<p class="small"><?php echo 'hello world'; ?></p>
<?php }
add_action( 'woocommerce_single_product_summary', 'add_after_product_title_rwk', 6 );
@rwkyyy
rwkyyy / gist:59a9bbe84e667fcadd60c416f6f051c0
Created May 18, 2018 12:25
Display free shipping in product loop
add_action( 'woocommerce_after_shop_loop_item_title', 'loc_show_free_shipping_badge' );
function loc_show_free_shipping_badge() {
global $post, $product;
if ( $product && $product->get_price() >= 100 ) {
echo '<span class="free-shipping">' . __( 'Livrare Gratuită!' ) . '</span>';
}
}
@rwkyyy
rwkyyy / EVD Cart Discount Rules
Last active February 2, 2022 18:14
WooCommerce conditional subtotal cart discounts
<?php
/**
* Plugin Name: EVD - Card Discount Rules
* Plugin URI: https://rwky.ro
* Description: Discount rules for cart
* Version: 1.0
* Author: Eduard Vasile Doloc
* Author URI: http://rwky.ro
* Developer: Eduard Vasile Doloc
* Developer URI: http://rwky.ro
@rwkyyy
rwkyyy / Popup Maker - at 3 pages popup
Last active June 4, 2016 19:19 — forked from anonymous/Popup Maker - at 3 pages popup
Simle jQuery to show a popup at 3rd page of a visitor - Wordpress Popup Maker
jQuery(document).ready(function ($) {
{
var visited = Cookies.get('visited');
if (visited == undefined) {
Cookies.set('visited', 0, {path: '/'});
}
else if (visited < 2) {
Cookies.set('visited', ++visited, {path: '/'});
}
else if (visited == 2) {