Skip to content

Instantly share code, notes, and snippets.

View rameshelamathi's full-sized avatar

Ramesh Elamathi rameshelamathi

View GitHub Profile
@rameshelamathi
rameshelamathi / change-recovery-url.php
Created November 2, 2021 05:29 — forked from iamsathyaseelan/change-recovery-url.php
change recovery url retainful
add_filter('retainful_recovery_redirect_url','retainful_recovery_redirect_url');
function retainful_recovery_redirect_url($url){
$url = wc_get_cart_url();
return $url;
}
@rameshelamathi
rameshelamathi / gist:3038268c05d6e96f749ed83f3591fe52
Created May 25, 2021 16:25
Get Elementor built page content with CSS styles in WPGraphQL
add_action( 'graphql_register_types', function() {
$field_config = [
'type' => 'String',
'description' => __('Elementor rendered content', 'wp-graphql'),
'args' => [
'myArg' => [
'type' => 'String',
],
],
@rameshelamathi
rameshelamathi / frontend.php
Created June 9, 2020 07:12 — forked from iamsathyaseelan/frontend.php
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;
}
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("failed"))){
$order_status = "pending";
}
return $order_status;
}
add_filter('woo_discount_rules_remove_event_woocommerce_before_calculate_totals', '__return_true');
add_filter('woo_discount_rules_apply_rules_repeatedly', '__return_true');
@rameshelamathi
rameshelamathi / smart-coupons-snippet.php
Created April 25, 2020 14:26
Smart coupons compatibility for Woo Discount Rules
add_filter('woo_discount_rules_remove_event_woocommerce_before_calculate_totals', '__return_true');
add_filter('woo_discount_rules_apply_rules_repeatedly', '__return_true');
@rameshelamathi
rameshelamathi / cancelled_as_abandoned.php
Last active March 11, 2020 06:17 — forked from iamsathyaseelan/change_order_Status.php
Snippet to treat cancelled and failed orders as abandoned carts.
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;
}
@rameshelamathi
rameshelamathi / downloadable_rule.php
Created October 4, 2019 15:03
Apply a discount rule only for downlodable products. Exclude the rest
function woo_discount_rules_exclude_cart_item_from_discount_method($excluded_products, $rule, $variants){
$eligible_rule_id = 9999; // enter the rule ID that applies for downloadable product only
if(isset($rule->ID) && $rule->ID == $eligible_rule_id ) {
$query = new WC_Product_Query( array(
'downloadable' => false,
'return' => 'ids',
) );
@rameshelamathi
rameshelamathi / downloadable.php
Created October 4, 2019 13:20
Apply discount only for downloadable product
function woo_discount_rules_exclude_cart_item_from_discount_method($skip, $cart_item){
$product_ids_to_exclude = array();
if(is_object($cart_item['data']) && method_exists($cart_item['data'], 'is_downloadable')) {
if(!$cart_item['data']->is_downloadable()) {
$skip = true;
}
}
return $skip;
}
@rameshelamathi
rameshelamathi / product-types.php
Created October 4, 2019 12:36
Product Type as Categories for Woo Discount Rule
function woo_discount_rules_accepted_taxonomy_for_category_method($taxonomy){
$taxonomy[] = 'product_type';
return $taxonomy;
}
add_filter('woo_discount_rules_accepted_taxonomy_for_category', 'woo_discount_rules_accepted_taxonomy_for_category_method', 10);
function woo_discount_rules_load_additional_taxonomy_method($categories, $product_id){
$taxonomy_to_apply = 'product_type';
$tags = get_the_terms( $product_id, $taxonomy_to_apply );