Skip to content

Instantly share code, notes, and snippets.

Ashlin AshlinRejo

Block or report user

Report or block AshlinRejo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AshlinRejo
AshlinRejo / Custom Delivery Schedules: Disable first delivery order
Created Jan 3, 2020
Custom Delivery Schedules: Disable first delivery order
View Custom Delivery Schedules: Disable first delivery order
add_filter('fcds_wcs_create_delivery_schedules_on_subscription_order_complete', '__return_false');
@AshlinRejo
AshlinRejo / Discount rules: Round the subtotal before apply discount in cart for cart rules
Created Dec 18, 2019
Discount rules: Round the subtotal before apply discount in cart for cart rules
View Discount rules: Round the subtotal before apply discount in cart for cart rules
function woo_discount_rules_before_calculate_discount_from_subtotal_in_cart_method($subtotal, $discount_type){
if(function_exists('wc_round_discount')){
$subtotal = wc_round_discount($subtotal, 0);
}
return $subtotal;
}
add_filter('woo_discount_rules_before_calculate_discount_from_subtotal_in_cart', 'woo_discount_rules_before_calculate_discount_from_subtotal_in_cart_method', 10, 2);
@AshlinRejo
AshlinRejo / Email Customizer: Load additional data from the plugin WooCommerce Checkout Manager by QuadLayers
Created Dec 13, 2019
Email Customizer: Load additional data from the plugin WooCommerce Checkout Manager by QuadLayers
View Email Customizer: Load additional data from the plugin WooCommerce Checkout Manager by QuadLayers
/**
* To load the additional shortcode in Woo Email Template
*
* @param $shortcodes array
* @return array
* */
function woo_email_drag_and_drop_builder_load_additional_shortcode_method($shortcodes){
$shortcodes['additional_fields_from_checkout_manager'] = "Aditional details";
return $shortcodes;
}
@AshlinRejo
AshlinRejo / Email customizer: adding additional shortcode for custom data
Created Dec 11, 2019
Email customizer: adding additional shortcode for custom data
View Email customizer: adding additional shortcode for custom data
/**
* To load the additional shortcode in Woo Email Template
*
* @param $shortcodes array
* @return array
* */
function woo_email_drag_and_drop_builder_load_additional_shortcode_method($shortcodes){
$shortcodes['wec_delivery_method_1'] = "To load delivery method 1 value";
$shortcodes['wec_delivery_method_2'] = "To load delivery method 2 value";
return $shortcodes;
@AshlinRejo
AshlinRejo / J2Store Booking: For Pre-fill the person fields from URL data
Created Dec 10, 2019
J2Store Booking: For Pre-fill the person fields from URL data
View J2Store Booking: For Pre-fill the person fields from URL data
<?php
/**
* For preload the person value from the request URL
* Copy this and do an override in the path [SITE_TEMPLATE_PATH]/html/plugins/j2store/app_booking/number.php
* */
defined('_JEXEC') or die;
if(is_array($vars->field)){
$vars->field = \Joomla\Utilities\ArrayHelper::toObject($vars->field);
}
@AshlinRejo
AshlinRejo / Discount Rule: For displaying discount %(Eg: %10) to left of discount value in discount table
Created Dec 10, 2019
Discount Rule: For displaying discount %(Eg: %10) to left of discount value in discount table
View Discount Rule: For displaying discount %(Eg: %10) to left of discount value in discount table
<?php
/**
* List matched Rules in Table format
*
* This template can be overridden by copying it to yourtheme/plugin-folder-name/discount-table.php
*/
if (!defined('ABSPATH')) exit; // Exit if accessed directly
if (!isset($table_data) || empty($table_data)) return false;
$base_config = (is_string($data)) ? json_decode($data, true) : (is_array($data) ? $data : array());
@AshlinRejo
AshlinRejo / Email Customizer: compatible with wpml
Created Dec 3, 2019
Email Customizer: compatible with wpml
View Email Customizer: compatible with wpml
if(!function_exists('woo_email_customizer_load_language_for_sending_email_method')){
function woo_email_customizer_load_language_for_sending_email_method($language, $template){
if($language == 'fr-ch' || $language == 'fr_ch') {
$language = 'fr_CH';
}
if($language == 'de-ch') {
$language = 'de_CH';
}
if($language == 'de') {
$language = 'de_DE';
@AshlinRejo
AshlinRejo / Discount rules: Skip an item from calculating subtotal for price rules
Created Dec 3, 2019
Discount rules: Skip an item from calculating subtotal for price rules
View Discount rules: Skip an item from calculating subtotal for price rules
function woo_discount_rules_skip_item_to_calculate_subtotal_for_price_rules_free_products($include_item, $cart_item, $rule){
$product_ids_to_exclude = array(10, 24);//ENTER THE PRODUCT IDS to exclude from calculating subtotal
if(isset($cart_item['data']) && !empty($cart_item['data'])){
$_product = $cart_item['data'];
$product_id = $_product->get_id();
if(in_array($product_id, $product_ids_to_exclude)){
$include_item = false;
}
}
return $include_item;
@AshlinRejo
AshlinRejo / Discount rules: Exclude strikeout for specific product type
Created Nov 29, 2019
Discount rules: Exclude strikeout for specific product type
View Discount rules: Exclude strikeout for specific product type
function woo_discount_rules_exclude_product_type_for_sale_price_strikeout_adjustment_method($exclude_product_type, $product){
$exclude_product_type[] = 'auction';
return $exclude_product_type;
}
add_filter('woo_discount_rules_exclude_product_type_for_sale_price_strikeout_adjustment', 'woo_discount_rules_exclude_product_type_for_sale_price_strikeout_adjustment_method', 10, 2);
@AshlinRejo
AshlinRejo / Discount rules: Load coupon select box value by search without count query
Created Nov 28, 2019
Discount rules: Load coupon select box value by search without count query
View Discount rules: Load coupon select box value by search without count query
add_filter('woo_discount_rules_load_coupon_value_by_search', '__return_true');
You can’t perform that action at this time.