This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('advanced_woo_discount_rules_remove_data_store_filters_while_search_products', '__return_false'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check user has discount or not. | |
*/ | |
if (class_exists('\Wdr\App\Controllers\DiscountCalculator') && !empty(\Wdr\App\Controllers\DiscountCalculator::$applied_rules)) { | |
// the user has discounts | |
} else { | |
// the user doesn't have any discounts | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cuw_get_product_data', function ($data, $product, $args) { | |
if (empty($args['to_display'])) { | |
return $data; | |
} | |
if (!empty($data['is_variable']) && method_exists($product, 'get_available_variations')) { | |
$has_choose_any_variant = false; | |
$available_variations = $product->get_available_variations(); | |
if (!empty($available_variations) && is_array($available_variations)) { | |
foreach ($available_variations as $variation_data) { | |
if (!empty($variation_data['attributes'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_footer', function () { | |
if (did_action('woocommerce_add_to_cart') >= 1) { ?> | |
<script> | |
jQuery(document).ready(function () { | |
jQuery('.uwpmc-widget-container').trigger('click'); | |
}); | |
</script> | |
<?php | |
} | |
}, 100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cuw_discount_text', function ($text, $product, $discount, $display_in) { | |
if (!empty($discount['type']) && $discount['type'] == 'fixed_price' && is_numeric($discount['value'])) { | |
if (method_exists('\CUW\App\Helpers\WC', 'getPriceToDisplay') && method_exists('\CUW\App\Helpers\WC', 'formatPriceRaw')) { | |
$price = apply_filters('cuw_convert_price', $discount['value'], 'fixed_price'); | |
$price = \CUW\App\Helpers\WC::getPriceToDisplay($product, $price, 1, $display_in); | |
$text = html_entity_decode(\CUW\App\Helpers\WC::formatPriceRaw($price)); | |
} | |
} | |
return $text; | |
}, 100, 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Register custom condition. | |
*/ | |
add_filter('cuw_conditions', function ($conditions) { | |
if (empty($conditions['custom']) && class_exists('CUWCustomCondition')) { | |
$conditions['custom'] = [ | |
'name' => __("Custom Conditions", 'checkout-upsell-woocommerce'), | |
'group' => __("Custom", 'checkout-upsell-woocommerce'), | |
'handler' => new CUWCustomCondition(), | |
'campaigns' => [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cuw_load_upsell_popup_dynamically_in_product_page', '__return_true'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cuw_templates', function ($templates) { | |
$templates['offer/custom-template-1'] = [ | |
'title' => '{discount} offer', | |
'description' => 'Hey there, you can get this offer by just clicking the checkbox below to add this offer to your order, you will never get such a discount on any other place on this site.', | |
'cta_text' => 'Get this exclusive offer now !', | |
'image_id' => 0, | |
'styles' => [ | |
'template' => ['border-width' => 'medium', 'border-style' => 'dashed', 'border-color' => '#c3c4c7', 'background-color' => '#fbfbfb'], | |
'title' => ['font-size' => '', 'color' => '#ffffff', 'background-color' => '#32cd32'], | |
'description' => ['font-size' => '', 'color' => '#525f7a', 'background-color' => '#d1ecf1'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_before_calculate_totals', function ($cart) { | |
if (!method_exists('\CUW\App\Helpers\Discount', 'getPrice')) { | |
return; | |
} | |
foreach ($cart->get_cart() as $cart_item) { | |
if (isset($cart_item['cuw_offer']) && isset($cart_item['data']) && $offer = $cart_item['cuw_offer']) { | |
if (!empty($offer['discount']) && isset($offer['discount']['type']) && $offer['discount']['type'] != 'no_discount') { | |
$offer_price = \CUW\App\Helpers\Discount::getPrice($cart_item['data'], $offer['discount']); | |
if (is_object($cart_item['data'])) { | |
$cart_item['data']->cuw_price = $offer_price; |
NewerOlder