Skip to content

Instantly share code, notes, and snippets.

View iamsathyaseelan's full-sized avatar

Sathyaseelan iamsathyaseelan

View GitHub Profile
@iamsathyaseelan
iamsathyaseelan / support_print_invice_for_retainful.php
Last active August 19, 2019 11:51
Code snippet to show next order coupon while printing invoice using "WooCommerce Print Invoice & Delivery Note"
/*
* 1. wcdn_after_branding => After the invoice logo
* 2. wcdn_after_addresses => After displaying the billing and shipping address
* 3. wcdn_after_info => After order details
* 4. wcdn_after_items => After the order items table
* 5. wcdn_after_notes => After the order notes
* 6. wcdn_after_thanks => After thanks
* 7. wcdn_after_colophon => After colophon
*
* Replace `wcdn_after_addresses` with any other mentioned hooks to change the display position
@iamsathyaseelan
iamsathyaseelan / add_to_cart_addon_popup_classes.php
Last active September 25, 2019 05:04
Retainful Premium - add to cart email collection (show popup for pages building using page builders)
/*
* Replace 'add_to_cart_button_classes' values with comma seperated multiple classes
*/
add_filter('retainful_premium_add_to_cart_collection_button_classes',function($classes){
//For version 1.0.9 above
return $classes['add_to_cart_button_classes'] = '.elementor-button-link';
//For version 1.0.9 and below
//return array('add_to_cart_button_classes' => '.elementor-button-link');
});
<?php
//Example:https://nimb.ws/PumFqI
if(!function_exists("rnoc_exit_intent_popup_condition_coupons")){
function rnoc_exit_intent_popup_condition_coupons($to_replace){
$cart_total = 0;
if(function_exists("WC")){
$cart_total = WC()->cart->total;
}
$coupon_code = "";
if($cart_total >100){
@iamsathyaseelan
iamsathyaseelan / invalid_order_status_for_ababdoned_cart.php
Last active December 16, 2019 04:55
consider following order status as abandoned order
<?php
add_filter("rnoc_abandoned_cart_invalid_order_statuses","rnoc_invalid_order_status_to_consider_as_abandoned_cart");
if(!function_exists("rnoc_invalid_order_status_to_consider_as_abandoned_car")){
function rnoc_invalid_order_status_to_consider_as_abandoned_cart($invalid_order_status){
/* Replace processing with invalid order status */
$invalid_order_status[] = "processing";
return $invalid_order_status;
}
}
?>
@iamsathyaseelan
iamsathyaseelan / removing-retainful-log.php
Created December 23, 2019 12:48
removing the retainful log
<?php
if(is_admin()) {
add_action('init', function () {
$path = ABSPATH . 'wp-content/retainful.log';
if (file_exists($path)) {
unlink($path);
}
});
}
?>
wp-content/themes/tatara/js/ajax.js
Line number : 12
Original:
=========
if (response) {
setTimeout(function () {
$('.cart_popup').html(response);
}, 500);
@iamsathyaseelan
iamsathyaseelan / rnoc_override_product_image_url.php
Created February 17, 2020 13:01
override product image URL
add_filter('rnoc_get_product_image_src','rnoc_override_product_image_url',10,2);
function rnoc_override_product_image_url($url,$product){
$url = str_replace('wp-content/uploads','zova_uploads',$url);
return $url;
}
@iamsathyaseelan
iamsathyaseelan / exit-intent-popup-with-areocheckout
Created February 28, 2020 08:05
exit intent popup was not showed with areo checkout
/* Retainful exit intent popup in checkout*/
add_filter("rnoc_load_exit_intent_popup_scripts_after","rnoc_load_exit_intent_popup_scripts",10);
function rnoc_load_exit_intent_popup_scripts($dependencies){
if(is_checkout()){
return array();
}
return $dependencies;
}
add_filter("rnoc_load_exit_intent_popup_settings","rnoc_load_exit_intent_popup_settings",10);
function rnoc_load_exit_intent_popup_settings($settings){
@iamsathyaseelan
iamsathyaseelan / snippet-noc-for-particular-order-status.php
Created March 4, 2020 13:13
allowing the next order coupons for particular order emails only
add_filter('rnoc_before_displaying_next_order_coupon','rnoc_before_displaying_next_order_coupon',10,2);
function rnoc_before_displaying_next_order_coupon($message,$order){
if (method_exists($order, 'get_status')) {
$order_status = $order->get_status();
$order_status = strtolower($order_status);
if($order_status == "processing"){
return $message;
}else{
return '';
}
@iamsathyaseelan
iamsathyaseelan / change_order_Status.php
Created March 11, 2020 06:12
changing the order status of the abandoned order to recover the order
add_filter('rnoc_abandoned_cart_order_status','rnoc_abandoned_cart_order_status',10,2);
function rnoc_abandoned_cart_order_status($order_status,$order){
if(in_array($order_status,array("cancelled","failed"))){
$order_status = "pending";
}
return $order_status;
}