Skip to content

Instantly share code, notes, and snippets.

View iamsathyaseelan's full-sized avatar

Sathyaseelan iamsathyaseelan

View GitHub Profile
@iamsathyaseelan
iamsathyaseelan / free-sample-product-title.php
Created April 6, 2020 11:00
getting free sample products
add_filter('rnoc_get_cart_line_item_details', 'rnoc_get_cart_line_item_details', 10, 5);
function rnoc_get_cart_line_item_details($item_array, $cart, $item_key, $item, $item_details)
{
if ($item_array['title'] == "Free Sample" && isset($item_details['free_sample']) && !empty($item_details['free_sample'])) {
$product = wc_get_product($item_details["free_sample"]);
$name = $item_array['title'] . " (" . $product->get_name() . ")";
$item_array['title'] = $name;
}
return $item_array;
}
@iamsathyaseelan
iamsathyaseelan / order_items.php
Created May 8, 2020 05:29
gist to hide paymant method in order items table
<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 / line_sub_total.php
Created May 21, 2020 06:30
line subtoal change
add_filter('retainful_get_line_item_total','retainful_get_line_item_total',10,5);
function retainful_get_line_item_total($total, $line_total, $line_total_tax, $item_details,$cart){
$line_total = (isset($item_details['line_subtotal']) && !empty($item_details['line_subtotal'])) ? $item_details['line_subtotal'] : $total;
return $line_total;
}
@iamsathyaseelan
iamsathyaseelan / easy_discount_issue_with_retainful.php
Last active May 21, 2020 13:01
easy_discount_issue_with_retainful.php
add_filter('rnoc_recover_cart_before_validate_coupon', 'rnoc_recover_cart_before_validate_coupon');
function rnoc_recover_cart_before_validate_coupon($code) {
if (substr($code, 0, 5) === "wccs_") {
return null;
}
return $code;
}
@iamsathyaseelan
iamsathyaseelan / remove_coupon_in_notification.php
Last active June 8, 2020 07:09
remove next ordercoupon in order notification email
add_filter('rnoc_before_displaying_next_order_coupon', "rnoc_before_displaying_next_order_coupon", 10, 2);
/**
* @param $message
* @param $order \WC_Order
* @return string
*/
function rnoc_before_displaying_next_order_coupon($message, $order)
{
if (method_exists($order, 'get_billing_email')) {
$order_email = $order->get_billing_email();
@iamsathyaseelan
iamsathyaseelan / class-public-controller.php
Last active June 9, 2020 06:56
wp otinn wheel code/controllers/class-public-controller.php (Line numbers: 89, 97)
<?php
namespace MABEL_WOF_LITE\Code\Controllers
{
use MABEL_WOF_LITE\Code\Models\Wheel_Model;
use MABEL_WOF_LITE\Code\Models\Wheels_VM;
use MABEL_WOF_LITE\Code\Services\Log_Service;
use MABEL_WOF_LITE\Code\Services\MailChimp_Service;
use MABEL_WOF_LITE\Code\Services\Wheel_service;
@iamsathyaseelan
iamsathyaseelan / frontend.php
Last active June 9, 2020 07:12
woo-lucky-wheel frontend/frontend.php(Line number: 661, 924, 931)
<?php
/*
Class Name: VI_WOO_LUCKY_WHEEL_Frontend_Frontend
Author: Andy Ha (support@villatheme.com)
Author URI: http://villatheme.com
Copyright 2015 villatheme.com. All rights reserved.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@iamsathyaseelan
iamsathyaseelan / order_items.php
Created June 9, 2020 11:00
email customizer plus template override for order item table to display table based on email type
<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 / 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;