Skip to content

Instantly share code, notes, and snippets.

View iamsathyaseelan's full-sized avatar

Sathyaseelan iamsathyaseelan

View GitHub Profile
@iamsathyaseelan
iamsathyaseelan / order_items.php
Created June 19, 2020 12:59
language not translated issue fixed
<div class="email-product-list" style="padding: 15px 25px;">
<?php
/**
* Order details table shown in emails.
*
* 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 the readme will list any important changes.
*/
@iamsathyaseelan
iamsathyaseelan / view_order_meta_shortcodes.php
Created June 23, 2020 12:18
view order meta shortcodes Email customizer plus
<?php
add_filter('woocommerce_email_customizer_plus_additional_short_codes_list',function($additional_short_codes){
$order_id = 803;
$order_meta_keys = get_post_custom_keys($order_id);
if (!empty($order_meta_keys)) {
$order_meta_values = get_post_meta($order_id);
foreach ($order_meta_keys as $order_meta_key) {
if (isset($order_meta_values[$order_meta_key]) && isset($order_meta_values[$order_meta_key][0])) {
$order_meta_key_for_short_code = str_replace(' ', '_', $order_meta_key);
$key = 'order_meta.'.$order_meta_key_for_short_code;
@iamsathyaseelan
iamsathyaseelan / email_basket_custom_modal_j2store.php
Created June 25, 2020 07:57
Custom modal in email basket j2store
<?php
/*
* @package plg_j2store_emailbasket
* @subpackage J2Store
* @author Gokila Priya - Weblogicx India http://www.weblogicxindia.com
* @copyright Copyright (c) 2014 Weblogicx India Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
* --------------------------------------------------------------------------------
*/
@iamsathyaseelan
iamsathyaseelan / cart_tracking_once_per_session.php
Created July 28, 2020 12:45
don't track more than one cart per session
<?php
add_action('woocommerce_new_order','rnoc_woocommerce_new_order',10,1);
function rnoc_woocommerce_new_order($order_id){
$no_of_orders_in_session = rnoc_orders_per_session_count();
WC()->session->set('rnoc_orders_per_session_count',$no_of_orders_in_session + 1);
}
add_filter('rnoc_can_track_abandoned_carts','rnoc_can_track_abandoned_carts',20);
function rnoc_can_track_abandoned_carts($can_track){
$no_of_orders_in_session = rnoc_orders_per_session_count();
@iamsathyaseelan
iamsathyaseelan / split-order-items-table.php
Created August 3, 2020 12:34
split order item details in email customizer plus into 2 table
<div class="email-product-list" style="padding: 15px 25px;">
<h6>Product details:</h6>
<?php
/**
* Order details table shown in emails.
*
* 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 the readme will list any important changes.
@iamsathyaseelan
iamsathyaseelan / order_items.php
Last active September 16, 2020 10:51
adding purchase note in order email for email customizer plus
<div class="email-product-list" style="padding: 15px 25px;">
<?php
/**
* Order details table shown in emails.
*
* 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 the readme will list any important changes.
*/
@iamsathyaseelan
iamsathyaseelan / wecp_get_customer_role.php
Created September 24, 2020 05:57
email customizer plus - get customer role shortcode
add_filter('woocommerce_email_customizer_plus_additional_short_codes_list', 'wecpLoadAdditionalShortCodes', 10, 3);
function wecpLoadAdditionalShortCodes($additional_short_codes){
$additional_short_codes['customer.role'] = 'get customer role';
return $additional_short_codes;
}
add_filter('woocommerce_email_customizer_plus_short_code_values', 'wecpLoadAdditionalData', 10, 4);
function wecpLoadAdditionalData($short_codes, $order, $args, $sample){
if (is_array($short_codes)) {
$user_role = '';
@iamsathyaseelan
iamsathyaseelan / change_referral_url.php
Last active December 4, 2020 04:08
change referral login url
<?php
add_action("rnoc_referral_login_url",function($login_url){
return "https://www.happynappy.ie/wp-login.php";
});
add_action("rnoc_referral_register_url",function($register_url){
return "https://www.happynappy.ie/wp-login.php?action=register&redirect_to=https://www.happynappy.ie/my-account/";
});
@iamsathyaseelan
iamsathyaseelan / get_order_payemt_url.php
Created December 4, 2020 05:58
email customizer payment url
<?php
add_filter('woocommerce_email_customizer_plus_short_code_values', function ($short_codes, $order, $args, $sample) {
/**
* @var $order \WC_Order
*/
$payment_url = "";
if (method_exists($order, 'get_checkout_payment_url')) {
$payment_url = $order->get_checkout_payment_url();
}
$short_codes['order']['payment_url'] = $payment_url;
<!doctype html>
<html lang="en">
<head>
<title>Simple todo list</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>