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_cart', function (){ | |
| ?> | |
| <script type="text/javascript"> | |
| jQuery( document ).ready(function() { | |
| jQuery( window ).load(function() { | |
| jQuery("[name='update_cart']").removeAttr('disabled'); | |
| jQuery("[name='update_cart']").trigger("click"); | |
| }); | |
| }); | |
| </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_action('woocommerce_review_order_before_cart_contents', function (){ | |
| if (!WC()->cart->is_empty()){ | |
| WC()->cart->calculate_totals(); | |
| } | |
| if ( is_checkout() ) { | |
| ?> | |
| <script type="text/javascript"> | |
| jQuery(function($){ | |
| $(document.body).trigger("update_checkout") | |
| }); |
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_cart', function (){ | |
| if(class_exists('\Wdr\App\Router')){ | |
| remove_action('woocommerce_before_cart', array(\Wdr\App\Router::$manage_discount, 'showAppliedRulesMessages')); | |
| remove_action('woocommerce_before_cart', array(\Wdr\App\Router::$manage_discount, 'displayPromotionMessages')); | |
| } | |
| }, 11); |
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_filter_passed', function($filter_passed, $rule, $product, $sale_badge){ | |
| //'array(419,420)' - give rule id as you needed | |
| if(in_array($rule->getId(),array(419)) && class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
| $rule_filter = $rule->getFilter(); | |
| $product_id = \Wdr\App\Helpers\Woocommerce::getProductId($product); | |
| $parent_product_id = \Wdr\App\Helpers\Woocommerce::getProductParentId($product_id); | |
| $product_id = !empty($parent_product_id) ? $parent_product_id : $product_id; | |
| if($rule_filter){ | |
| foreach($rule_filter as $filter){ | |
| $type = isset($filter->type) ? $filter->type : ''; |
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
| if ( class_exists('\Wdr\App\Controllers\ManageDiscount')) { | |
| $rules = \Wdr\App\Controllers\ManageDiscount::$available_rules; | |
| $start_date = $end_date = array(); | |
| if(!empty($rules) && is_array($rules)){ | |
| foreach ($rules as $rule){ | |
| if($rule->rule->enabled == 1){ | |
| $rule_id = $rule->rule->id; | |
| //get timestamp | |
| $start_date_timestamp = $rule->rule->date_from; | |
| $end_date_timestamp = $rule->rule->date_to; |
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_filter_passed', function($filter_passed, $rule, $product, $sale_badge){ | |
| //'array(1,2,3)' - give rule id as you needed | |
| if(in_array($rule->getId(),array(1,2)) && class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
| $rule_filter = $rule->getFilter(); | |
| $has_filter_passed = array(); | |
| $product_id = \Wdr\App\Helpers\Woocommerce::getProductId($product); | |
| $parent_product_id = \Wdr\App\Helpers\Woocommerce::getProductParentId($product_id); | |
| if($rule_filter){ | |
| foreach($rule_filter as $filter){ | |
| $type = isset($filter->type) ? $filter->type : ''; |
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_review_order_before_payment', function(){ | |
| if (!is_cart()) { | |
| ?> | |
| <script type="text/javascript"> | |
| (function ($) { | |
| $('form.checkout').on('change', '.shipping_method', function () { | |
| $('body').trigger('update_checkout'); | |
| location.reload(); | |
| }); | |
| })(jQuery); |
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
| <?php | |
| if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
| if (!empty($ranges) && !empty($woocommerce)) { | |
| if ($ranges['layout']['type'] == 'advanced') { | |
| $i=0; | |
| $existing_rule_id = 0; | |
| $tag_opened = false; | |
| foreach ($ranges as $key => $badge_settings){ | |
| if($key !== 'layout'){ |
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_review_order_before_cart_contents', function (){ | |
| if ( is_checkout() ) { ?> | |
| <script type="text/javascript"> | |
| jQuery('form.checkout').on('change', '#billing_postcode', function () { | |
| jQuery('body').trigger('update_checkout'); | |
| }); | |
| </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_filter('advanced_woo_discount_rules_converted_currency_value', function($price) { | |
| if(is_numeric($price) && !empty($price)) { | |
| if(function_exists('wcpbc_the_zone')){ | |
| if(wcpbc_the_zone()){ | |
| $price = wcpbc_the_zone()->get_exchange_rate_price( $price, true, 'generic', '' ); | |
| } | |
| } | |
| } | |
| return $price; | |
| }, 10); |