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 () { ?> | |
| <script> | |
| jQuery(document.body).on('cuw_offer_added_to_cart', function() { | |
| location.reload(); | |
| }); | |
| </script> | |
| <?php | |
| }, 100000); |
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
| // Note: You might need to choose "Use a shortcode [cuw_fbt]" as a display location in FBT campaign | |
| add_filter('cuw_fbt_products_display_locations', function($locations) { | |
| $locations['cuw_fbt_shortcode'] = esc_html__("Use a shortcode [cuw_fbt]", 'checkout-upsell-woocommerce'); | |
| return $locations; | |
| }); | |
| add_shortcode('cuw_fbt', function() { | |
| ob_start(); | |
| do_action('cuw_fbt_shortcode'); | |
| return ob_get_clean(); | |
| }); |
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
| // Checkout Upsell: Compatibility script for FOX - Currency Switcher (formerly WOOCS) | |
| if (!function_exists('get_woocs_convertion_rate') && !function_exists('cuw_get_converted_price')) { | |
| function get_woocs_convertion_rate() { | |
| global $WOOCS; | |
| if (is_object($WOOCS) && method_exists($WOOCS, 'get_currencies')) { | |
| $currencies = $WOOCS->get_currencies(); | |
| $convert_to_current_currency = false; | |
| if (isset($WOOCS->is_geoip_manipulation) && $WOOCS->is_geoip_manipulation) { | |
| $convert_to_current_currency = 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_action('wp_footer', function() { ?> | |
| <script> | |
| jQuery(document.body).on('applied_coupon_in_checkout removed_coupon_in_checkout', function () { | |
| location.reload(); | |
| }); | |
| </script> | |
| <?php | |
| }); |
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('cuw_after_init', function() { | |
| if (class_exists('CUW\App\Modules\Conditions\Base')) { | |
| class CUWLanguages extends \CUW\App\Modules\Conditions\Base | |
| { | |
| // to check condition | |
| public function check($condition, $data) { | |
| return isset($condition['value']) && $condition['value'] == cuw_get_current_language(); | |
| } | |
| // to load condition template |
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() { | |
| ?> | |
| <script type="text/javascript"> | |
| jQuery('.cuw-offer .cuw-product-image img:nth-child(2)').remove(); | |
| </script> | |
| <?php | |
| }); |
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('admin_enqueue_scripts', function() { | |
| if (isset($_GET['page']) && $_GET['page'] == 'checkout-upsell-woocommerce') { | |
| if (function_exists('wp_scripts') && isset(wp_scripts()->registered)) { | |
| foreach (array_keys(wp_scripts()->registered) as $script) { | |
| if (strpos($script, 'cuw_') === false && strpos($script, 'bootstrap') !== false) { | |
| wp_deregister_script($script); | |
| } | |
| } | |
| } | |
| } |
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_disable_strikeout_for_product_types', function ($product_types) { | |
| $product_types[] = 'yith_bundle'; | |
| return $product_types; | |
| }, 10); |
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_cart_item_offer_label', function ($label) { | |
| $label = esc_html__("Add On", 'checkout-upsell-woocommerce'); // here you can change the text | |
| return $label; | |
| }); |
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('option_cuw_offers_add_limit', function($value) { | |
| $value = 10; // here you can set the maximum number of offers a customer can pick at a time | |
| return $value; | |
| }); |