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_apply_free_shipping', function ($has_free_shipping){ | |
| if(class_exists('\Wdr\App\Router')){ | |
| $manage_discount = \Wdr\App\Router::$manage_discount; | |
| add_action('woocommerce_after_calculate_totals', array($manage_discount, 'removeThirdPartyCoupon'), 20); | |
| } | |
| return $has_free_shipping; | |
| }, 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_action('advanced_woo_discount_rules_after_apply_discount', function (){ | |
| $cart_items = WC()->cart->get_cart(); | |
| if(!empty($cart_items)){ | |
| foreach ($cart_items as $key => $item){ | |
| if(isset($item['bundled_by'])){ | |
| if(isset($cart_items[$item['bundled_by']])){ | |
| $itemParent = $cart_items[$item['bundled_by']]; | |
| if(isset($itemParent['data']->is_awdr_free_product) && $itemParent['data']->is_awdr_free_product){ | |
| $item['data']->set_price(0); | |
| } |
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('woocommerce_per_product_shipping_ship_via', function ($ship_via){ | |
| $ship_via[] = 'wdr_free_shipping'; | |
| return $ship_via; | |
| }); |
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 | |
| /** | |
| * Get discount of a product | |
| * @param $product integer|object (Product object Example: wc_get_product($product_id)) | |
| * @param $quantity int | |
| * @return boolean|float|int - is product has no discounts it returns false | |
| */ | |
| $discount = apply_filters('advanced_woo_discount_rules_get_discount_price', $product, $quantity); | |
| if($discount !== false){ | |
| echo $discount // HERE YOU GET DISCOUNT PRICE |
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
| function custom_sale_hook($hook) { | |
| return 'my_custom_hook'; | |
| } | |
| add_action('plugins_loaded', function () { | |
| add_filter('advanced_woo_discount_rules_custom_position_to_show_discount_bar', 'custom_sale_hook'); | |
| }, 0); |
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_hide_specific_rules_in_bulk_table', function($status, $rule_id, $rule, $product){ | |
| $exclude_rule_id = array(10, 12);//Here we need to enter rule id | |
| if(in_array($rule_id, $exclude_rule_id)){ | |
| $status = true; //Set as true if we want to disable discount table in front end. | |
| } | |
| return $status; | |
| }, 10, 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
| <?php | |
| $month_before_day = strpos( ( 'F j, Y' ), 'F' ) < strpos( ( 'F j, Y' ), 'j' ); | |
| ?> | |
| <fieldset class="bookings-date-picker bookings-date-picker-<?php echo $vars->product_type; ?> <?php echo implode( ' ', (array)$vars->field->class ); ?>" data-appid="<?php echo $vars->id; ?>"> | |
| <legend> | |
| <span class="label"><?php echo isset($vars->field->label) ? $vars->field->label: ''; ?></span>: <small class="bookings-date-picker-choose-date"><?php echo JText::_( 'Choose...' ); ?></small> | |
| </legend> | |
| <div class="picker" data-display="<?php echo $vars->field->display; ?>" data-duration-unit="<?php echo $vars->field->duration_unit;?>" data-availability='<?php echo json_encode( $vars->field->availability_rules ) ; ?>' |
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_cart_strikeout_price_html', function ($new_item_price_html, $item_price, $cart_item, $cart_item_key){ | |
| if(class_exists('\Wdr\App\Router')){ | |
| $manage_discount = \Wdr\App\Router::$manage_discount; | |
| if(isset($manage_discount::$calculated_cart_item_discount) && isset($manage_discount::$calculated_cart_item_discount[$cart_item_key])){ | |
| $discounts = $manage_discount::$calculated_cart_item_discount[$cart_item_key]; | |
| if(isset($discounts['initial_price']) && isset($discounts['discounted_price'])){ | |
| $saved_amount = $discounts['initial_price']-$discounts['discounted_price']; | |
| if($saved_amount > 0){ | |
| $saved_amount = \Wdr\App\Helpers\Woocommerce::formatPrice($saved_amount); | |
| $new_item_price_html .= $manage_discount->getYouSavedText($saved_amount); |
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_custom_target_for_variable_product_on_qty_update', function ($target){ | |
| $target = 'div.woocommerce-variation-add-to-cart .price'; | |
| return $target; | |
| }, 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_action('wp_footer', function (){ | |
| ?> | |
| <script> | |
| jQuery(document).ready(function(){ | |
| $(document).on('change', '[name="quantity"]', function (){ | |
| var awdr_qty_object = $(this); | |
| setTimeout(function(){ | |
| var $qty = awdr_qty_object.val(); | |
| var $product_id = 0; | |
| var $price_place = ""; |