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: 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 / 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: 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 / 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: 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 Discount Rules: Skip some product from bogo like free product when applying second time
Last active October 4, 2018 07:39
Woo Discount Rules: Skip some product from bogo like free product when applying second time
if(!function_exists('woo_discount_rules_skip_discount_for_free_product_method')){
function woo_discount_rules_skip_discount_for_free_product_method($skip_free_product, $cart_item){
$_product = $cart_item['data'];
//Example
if(!empty($_product)){
$price = $_product->get_price();
if($price == 0){
if(!empty($cart_item['thwepo_options'])) return true;
}
}
@AshlinRejo
AshlinRejo / Woo Discount Rules: If some plugin override the price
Last active October 4, 2018 07:39
Woo Discount Rules: If some plugin override the price
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){
return true;
@AshlinRejo
AshlinRejo / Woo Discount Rules: To handle specific attribute based on all selected attributes
Last active October 4, 2018 07:40
Woo Discount Rules: To handle specific attribute based on all selected attributes
if(!function_exists('woo_discount_rules_price_rule_check_in_all_selected_attributes_method')){
/**
* Rule based on all attributes
*
* @param boolean $in_all_attribute
* @param int $rule_order_id
* @return boolean
* */
function woo_discount_rules_price_rule_check_in_all_selected_attributes_method($in_all_attribute, $rule_order_id){
return true;
@AshlinRejo
AshlinRejo / Woo Discout Rules: For disable the variant strikeout through ajax
Last active October 4, 2018 07:40
Woo Discout Rules: For disable the variant strikeout through ajax
if(!function_exists('woo_discount_rules_run_variation_strikeout_through_ajax_method')){
function woo_discount_rules_run_variation_strikeout_through_ajax_method($do_ajax){
return false;
}
}
add_filter('woo_discount_rules_run_variation_strikeout_through_ajax', 'woo_discount_rules_run_variation_strikeout_through_ajax_method');
if(!function_exists('woo_discount_rules_run_variation_strike_out_with_ajax_method')){
/**
@AshlinRejo
AshlinRejo / Add the below code in template function.pho to support WooCommerce Wholesale Prices Premium - Rymera Web Co with Woo Discount rules
Last active October 4, 2018 07:41
Add the below code in template function.pho to support WooCommerce Wholesale Prices Premium - Rymera Web Co with Woo Discount rules
if(!function_exists('woo_discount_rules_remove_event_woocommerce_before_calculate_totals_for_wholesale_prices')){
/**
* Compatible for Wholesale price
* */
function woo_discount_rules_remove_event_woocommerce_before_calculate_totals_for_wholesale_prices($remove_event){
return true;
}
}
add_filter('woo_discount_rules_remove_event_woocommerce_before_calculate_totals', 'woo_discount_rules_remove_event_woocommerce_before_calculate_totals_for_wholesale_prices');