Skip to content

Instantly share code, notes, and snippets.

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

Ashlin AshlinRejo

🏠
Working from home
View GitHub Profile
@AshlinRejo
AshlinRejo / Woo Discount Rules: Support WooCommerce Extra Product Options Pro by ThemeHigh
Last active January 18, 2019 06:51
Woo Discount Rules: Support WooCommerce Extra Product Options Pro by ThemeHigh
if(!function_exists('woo_discount_rules_remove_event_woocommerce_before_calculate_totals_method')){
function woo_discount_rules_remove_event_woocommerce_before_calculate_totals_method($remove_event){
return true;
}
}
add_filter('woo_discount_rules_remove_event_woocommerce_before_calculate_totals', 'woo_discount_rules_remove_event_woocommerce_before_calculate_totals_method');
if(!function_exists('woo_discount_rules_has_price_override_method')){
function woo_discount_rules_has_price_override_method($hasPriceOverride, $product, $on_apply_discount, $cart_item){
if(!empty($cart_item['thwepo_options'])){
return true;
@AshlinRejo
AshlinRejo / Woo Discount Rules: Display rule in table even if condition doesn't matches
Last active October 4, 2018 07:38
Woo Discount Rules: Display rule in table even if condition doesn't matches
/**
* @return boolean
* */
function woo_discount_rules_rule_matches_to_display_in_table_method($matches, $product, $rule){
//Check condition as required and return boolean value true/false
}
add_filter('woo_discount_rules_rule_matches_to_display_in_table', 'woo_discount_rules_rule_matches_to_display_in_table_method', 10, 3);
@AshlinRejo
AshlinRejo / Woo Discout Rules: Change style for the zero value coupon
Last active October 4, 2018 07:38
Woo Discout Rules: Change style for the zero value coupon
if(!function_exists('woo_discount_rules_apply_style_for_zero_price_coupon_method')){
function woo_discount_rules_apply_style_for_zero_price_coupon_method($style, $coupon){
//Return the css as required based on $coupon
}
}
add_filter('woo_discount_rules_apply_style_for_zero_price_coupon', 'woo_discount_rules_apply_style_for_zero_price_coupon_method', 10, 2);
@AshlinRejo
AshlinRejo / Woo Discount Rules: Woocommerce currency switcher by realmag777 - Compatible while having fixed price rule instread of currency value in currency switcher
Last active April 6, 2020 13:41
Woo Discount Rules: Woocommerce currency switcher by realmag777 - Compatible while having fixed price rule instread of currency value in currency switcher
function woocs_fixed_raw_woocommerce_price_method($tmp_val, $product_data, $price){
remove_filter('woocs_fixed_raw_woocommerce_price', 'woocs_fixed_raw_woocommerce_price_method', 10, 3);
global $flycart_woo_discount_rules;
if(!empty($flycart_woo_discount_rules)){
global $product;
if(empty($product)){
$discount_price = $flycart_woo_discount_rules->pricingRules->getDiscountPriceOfProduct($product_data);
if($discount_price !== null) $tmp_val = $discount_price;
}
}
@AshlinRejo
AshlinRejo / Woo Discount Rules: Get discount for a product
Last active November 18, 2019 07:40
Woo Discount Rules: Get discount for a product
/**
* To get discount amount for the specific products
* If there is no discount it return null value.
*/
global $flycart_woo_discount_rules;
if(!empty($flycart_woo_discount_rules)){
$discounted_price = $flycart_woo_discount_rules->pricingRules->getDiscountPriceOfProduct($product);
}
@AshlinRejo
AshlinRejo / Woo Discount rules: to support with WooCommerce Gravity Forms Product Add-Ons
Last active October 4, 2018 07:37
Woo Discount rules: to support with WooCommerce Gravity Forms Product Add-Ons
if(!function_exists('woo_discount_rules_has_price_override_method')){
function woo_discount_rules_has_price_override_method($hasPriceOverride, $product){
return true;
}
}
add_filter('woo_discount_rules_has_price_override', 'woo_discount_rules_has_price_override_method', 10, 2);
@AshlinRejo
AshlinRejo / Email Customizer: For making the template rtl css: yourtheme::woocommerce::emails::email-styles.php
Last active October 4, 2018 07:36
Email Customizer: For making the template rtl css: yourtheme/woocommerce/emails/email-styles.php.
<?php
/**
* Email Styles
*
* This template can be overridden by copying it to yourtheme/woocommerce/emails/email-styles.php.
*
* 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
@AshlinRejo
AshlinRejo / Woo Discount Rules: Compatible with strikeout for woocommerce-subscribe-all-the-things
Last active October 4, 2018 07:35
Woo Discount Rules: Compatible with strikeout for woocommerce-subscribe-all-the-things
function woo_discount_rules_run_product_price_strikeout_method($run_strikeout, $product){
if(class_exists('WCS_ATT_Product_Schemes')){
if (WCS_ATT_Product_Schemes::has_subscription_schemes( $product ) ) {
return false;
}
}
return $run_strikeout;
}
@AshlinRejo
AshlinRejo / Woo Email Customizer: Load image original size - Do template override for the file email-order-items-3.php
Created October 9, 2018 08:02
Woo Email Customizer: Load image original size - Do template override for the file email-order-items-3.php
<?php
/**
* Email Order Items
*
* This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-items.php.
*
* 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
@AshlinRejo
AshlinRejo / Woo Email Customizer: load template css aswell
Created October 12, 2018 07:41
Woo Email Customizer: load template css aswell
if(!function_exists('woo_email_customizer_load_css_from_template_method')){
function woo_email_customizer_load_css_from_template_method($load_css_from_theme){
return true;
}
}
add_filter('woo_email_customizer_load_css_from_template', 'woo_email_customizer_load_css_from_template_method', 10);