Changeset 3400976
- Timestamp:
- 11/22/2025 02:38:41 PM (4 months ago)
- Location:
- advanced-coupon-for-woocommerce
- Files:
-
- 21 added
- 6 edited
-
tags/1.1.1 (added)
-
tags/1.1.1/advanced-coupon-for-woocommerce.php (added)
-
tags/1.1.1/assets (added)
-
tags/1.1.1/assets/admin.min.css (added)
-
tags/1.1.1/assets/admin.min.js (added)
-
tags/1.1.1/assets/select2.min.css (added)
-
tags/1.1.1/assets/vue.js (added)
-
tags/1.1.1/assets/vue.min.js (added)
-
tags/1.1.1/inc (added)
-
tags/1.1.1/inc/class-admin.php (added)
-
tags/1.1.1/inc/class-condition-billing-shipping.php (added)
-
tags/1.1.1/inc/class-condition-cart-products.php (added)
-
tags/1.1.1/inc/class-condition-cart.php (added)
-
tags/1.1.1/inc/class-condition-date.php (added)
-
tags/1.1.1/inc/class-condition-user.php (added)
-
tags/1.1.1/inc/class-main.php (added)
-
tags/1.1.1/inc/class-utils.php (added)
-
tags/1.1.1/readme.txt (added)
-
tags/1.1.1/templates (added)
-
tags/1.1.1/templates/discount-condition.php (added)
-
tags/1.1.1/templates/discount-item.php (added)
-
trunk/advanced-coupon-for-woocommerce.php (modified) (2 diffs)
-
trunk/assets/admin.min.js (modified) (1 diff)
-
trunk/inc/class-condition-cart.php (modified) (1 diff)
-
trunk/inc/class-main.php (modified) (3 diffs)
-
trunk/inc/class-utils.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-coupon-for-woocommerce/trunk/advanced-coupon-for-woocommerce.php
r3400212 r3400976 4 4 * Plugin Name: Advanced Coupon for WooCommerce 5 5 * Description: Elevate your WooCommerce store with dynamic discounts based on cart conditions and user roles. Effortlessly managed from the WooCommerce coupon page. 6 * Version: 1.1. 06 * Version: 1.1.1 7 7 * Author: Repon Hossain 8 8 * Author URI: https://workwithrepon.com … … 22 22 23 23 define('ADVANCED_COUPON_FOR_WOOCOMMERCE_FILE', __FILE__); 24 define('ADVANCED_COUPON_FOR_WOOCOMMERCE_VERSION', '1.1. 0');24 define('ADVANCED_COUPON_FOR_WOOCOMMERCE_VERSION', '1.1.1'); 25 25 define('ADVANCED_COUPON_FOR_WOOCOMMERCE_BASENAME', plugin_basename(__FILE__)); 26 26 define('ADVANCED_COUPON_FOR_WOOCOMMERCE_URI', trailingslashit(plugins_url('/', __FILE__))); -
advanced-coupon-for-woocommerce/trunk/assets/admin.min.js
r3381106 r3400976 1 const __=wp.i18n["__"];!function(a){const t=wp.hooks.applyFilters("advanced_coupon_for_woocommerce_has_pro",!1);function n(){var t=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){var e=16*Math.random();return 0<t?(e=(t+e)%16|0,t=Math.floor(t/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===o?e:3&e|8).toString(16)})}const i=o=>Object.assign({...advanced_coupon_for_woocommerce_admin.select2_ajax_values_map},o.data("values-map"));var o={template:"#component-tiered-discount",components:{"discount-condition":{template:"#component-discount-condition",props:{condition:{type:Object},number:{type:Number,default:0}},data(){return{id:n(),...advanced_coupon_for_woocommerce_admin.condition_values,...advanced_coupon_for_woocommerce_admin.condition_ui_values,...this.condition}},beforeMount(){this.$parent.conditions[this.number]=this.$data},mounted(){wp.hooks.doAction("advanced_coupon_for_woocommerce_condition_mounted",this),this.preload_layout_data()},beforeUpdate(){a(this.$refs.select2_ajax).data("select2")&&a(this.$refs.select2_ajax).select2("destroy"),a(this.$refs.select2_dropdown).data("select2")&&a(this.$refs.select2_dropdown).select2("destroy")},updated(){const e=this;a(this.$refs.select2_ajax).select2({placeholder:a(this).data("placeholder"),ajax:{url:advanced_coupon_for_woocommerce_admin.ajax_url,dataType:"json",type:"POST",delay:500,data:function(o){var e=i(a(this));return{term:o.term,type:e.data_type,country:a(this).attr("data-country"),security:advanced_coupon_for_woocommerce_admin.nonce_get_dropdown_data,action:"advanced_coupon_for_woocommerce/get_dropdown_data"}},processResults:function(o){return{results:a.map(o.data,function(o){return{text:o.name,id:o.id}})}}}}).on("change",function(){var o=i(a(this)).model;o.length&&(e[o]=a(this).val())}),a(this.$refs.select2_dropdown).select2({placeholder:a(this).data("placeholder")}).on("change",function(){var o=a(this).data("model");o&&o.length&&(e[o]=a(this).val())}),wp.hooks.doAction("advanced_coupon_for_woocommerce_condition_updated",e)},watch:{type(){this.preload_layout_data()},cart_value_type:function(o){"in_cart"!==o&&this.preload_layout_data()},...wp.hooks.applyFilters("advanced_coupon_for_woocommerce_condition_watch",{})},methods:{get_countries(){return advanced_coupon_for_woocommerce_admin.countries},get_ui_data_items(o){return Array.isArray(this[o])?this[o]:[]},delete_item(){confirm(advanced_coupon_for_woocommerce_admin.i10n.delete_condition_warning)&&this.$parent.conditions.splice(this.number,1)},preload_layout_data(){const n=this;this.$nextTick(()=>{const e=i(a(n.$refs.select2_ajax));if(n[e.model]&&n[e.model].length){n.loading=!0;const t=new FormData;n[e.model].forEach(o=>{t.append("ids[]",o)}),t.append("type",e.data_type),t.append("security",advanced_coupon_for_woocommerce_admin.nonce_get_dropdown_data),t.append("action","advanced_coupon_for_woocommerce/get_dropdown_data"),wp.hooks.doAction("advanced_coupon_for_woocommerce_preload_form_data",this,t),fetch(advanced_coupon_for_woocommerce_admin.ajax_url,{method:"POST",body:t}).then(o=>o.json()).then(o=>{1==o.success&&(n[e.hold_data]=o.data)}).finally(()=>{n.loading=!1})}}),wp.hooks.doAction("advanced_coupon_for_woocommerce_condition_preload",this)},...wp.hooks.applyFilters("advanced_coupon_for_woocommerce_condition_methods",{})}},...wp.hooks.applyFilters("advanced_coupon_for_woocommerce.discount_tier_item.components",{})},props:{rule:{type:Object},ruleNo:{type:Number,default:0}},data(){return Object.assign({id:n(),discount:"",private_note:"",collapsed:!1,disabled:!1,offer_type:"both",discount_type:"fixed_discount",condition_relationship:"match_all",conditions:[],title:advanced_coupon_for_woocommerce_admin.i10n.discount_tier+" "+(this.ruleNo+1),...wp.hooks.applyFilters("advanced_coupon_for_woocommerce.discount_tier_item.data",{})},this.rule)},beforeMount(){this.$root.$data.discount_tiers[this.ruleNo]=this.$data},beforeUpdate(){this.$root.$data.discount_tiers[this.ruleNo]=this.$data},computed:{is_free_shipping(){return this.$root.free_shipping}},methods:{duplicate_rule(o){if(3<=this.$root.discount_tiers.length&&!1===t)return this.$root.show_pro_notice();var o=JSON.parse(JSON.stringify(this.$root.discount_tiers[o])),e=o.title.length?o.title+" "+advanced_coupon_for_woocommerce_admin.i10n.copy_text:"";this.$root.discount_tiers.push({...o,id:n(),title:e})},delete_rule(){confirm(advanced_coupon_for_woocommerce_admin.i10n.delete_discount_tier_warning)&&this.$root.discount_tiers.splice(this.ruleNo,1)},move_up(){var o,e,t;0!=this.ruleNo&&(e=(o=this.$root.discount_tiers).splice(this.ruleNo,1)[0],t=this.ruleNo-1,o.splice(t,0,e))},move_down(){var o,e=this.$root.discount_tiers,t=this.ruleNo+1;t>=e.length||(o=e.splice(this.ruleNo,1)[0],e.splice(t,0,o))}}};const e=Vue.createApp({data(){return{discount_tiers:[],disabled:!1,start_after_date:"",free_shipping:!1,rule_import_coupon:null,show_locked_modal:!1,start_tiered_discount:"immediately",match_discount_tier_priority:"highest_discount"}},components:{"discount-tier-item":o},mounted(){const e=this;this.reuse_methods(),this.set_data(a("#advanced-coupon-for-woocommerce").data("settings")),a(document).keyup(function(o){"Escape"===o.key&&(e.show_locked_modal=!1)})},updated(){this.reuse_methods()},computed:{get_json_data(){var o=JSON.parse(JSON.stringify(this.$data));delete o.free_shipping,delete o.rule_import_coupon,delete o.show_locked_modal;const t=Object.keys(advanced_coupon_for_woocommerce_admin.condition_ui_values);return t.push("id"),o.discount_tiers.forEach(o=>{delete o.id,Array.isArray(o.conditions)&&o.conditions.map(e=>{t.forEach(o=>{delete e[o]})})}),JSON.stringify(o)},has_import_rule_id(){return 0<parseInt(this.rule_import_coupon)}},methods:{has_pro(){return t},set_data(o){if("object"==typeof o)for(const e in o)this[e]=o[e]},add_new_discount_tier(){if(3<=this.discount_tiers.length&&!1===t)return this.show_pro_notice();this.discount_tiers.push({})},import_coupon_data(){var o=new FormData;o.append("coupon_id",this.rule_import_coupon),o.append("security",this.$refs.import_nonce.value),o.append("action","advanced_coupon_for_woocommerce/import_coupon_data"),fetch(advanced_coupon_for_woocommerce_admin.ajax_url,{method:"POST",body:o}).then(o=>o.json()).then(o=>{this.set_data(o.data)})},show_pro_notice(){this.show_locked_modal=!0},reuse_methods(){const o=this;a(this.$refs.import_tiered_discount_rule).select2({placeholder:a(this).data("placeholder"),ajax:{url:advanced_coupon_for_woocommerce_admin.ajax_url,dataType:"json",type:"POST",data:function(o){return{type:"coupon_rules",term:o.term,security:advanced_coupon_for_woocommerce_admin.nonce_get_dropdown_data,action:"advanced_coupon_for_woocommerce/get_dropdown_data"}},processResults:function(o){return{results:a.map(o.data,function(o){return{text:o.name,id:o.id}})}}}}).on("change",function(){o.rule_import_coupon=a(this).val()})}}}).mount("#advanced-coupon-for-woocommerce");a("#free_shipping").on("change",function(){e.free_shipping=a(this).is(":checked")}).trigger("change")}(jQuery);1 const __=wp.i18n["__"];!function(a){const t=wp.hooks.applyFilters("advanced_coupon_for_woocommerce_has_pro",!1);function n(){var t=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){var e=16*Math.random();return 0<t?(e=(t+e)%16|0,t=Math.floor(t/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===o?e:3&e|8).toString(16)})}const r=o=>Object.assign({...advanced_coupon_for_woocommerce_admin.select2_ajax_values_map},o.data("values-map"));var o={template:"#component-tiered-discount",components:{"discount-condition":{template:"#component-discount-condition",props:{condition:{type:Object},number:{type:Number,default:0}},data(){return{id:n(),...advanced_coupon_for_woocommerce_admin.condition_values,...advanced_coupon_for_woocommerce_admin.condition_ui_values,...this.condition}},beforeMount(){this.$parent.conditions[this.number]=this.$data},mounted(){wp.hooks.doAction("advanced_coupon_for_woocommerce_condition_mounted",this),this.preload_layout_data()},beforeUpdate(){a(this.$refs.select2_ajax).data("select2")&&a(this.$refs.select2_ajax).select2("destroy"),a(this.$refs.select2_dropdown).data("select2")&&a(this.$refs.select2_dropdown).select2("destroy")},updated(){const e=this;a(this.$refs.select2_ajax).select2({placeholder:a(this).data("placeholder"),ajax:{url:advanced_coupon_for_woocommerce_admin.ajax_url,dataType:"json",type:"POST",delay:500,data:function(o){var e=r(a(this));return{term:o.term,type:e.data_type,country:a(this).attr("data-country"),security:advanced_coupon_for_woocommerce_admin.nonce_get_dropdown_data,action:"advanced_coupon_for_woocommerce/get_dropdown_data"}},processResults:function(o){return{results:a.map(o.data,function(o){return{text:o.name,id:o.id}})}}}}).on("change",function(){var o=r(a(this)).model;o.length&&(e[o]=a(this).val())}),a(this.$refs.select2_dropdown).select2({placeholder:a(this).data("placeholder")}).on("change",function(){var o=a(this).data("model");o&&o.length&&(e[o]=a(this).val())}),wp.hooks.doAction("advanced_coupon_for_woocommerce_condition_updated",e)},watch:{type(){this.preload_layout_data()},cart_value_type:function(o){"in_cart"!==o&&this.preload_layout_data()},...wp.hooks.applyFilters("advanced_coupon_for_woocommerce_condition_watch",{})},methods:{get_countries(){return advanced_coupon_for_woocommerce_admin.countries},get_ui_data_items(o){return Array.isArray(this[o])?this[o]:[]},delete_item(){confirm(advanced_coupon_for_woocommerce_admin.i10n.delete_condition_warning)&&this.$parent.conditions.splice(this.number,1)},preload_layout_data(){const n=this;this.$nextTick(()=>{const e=r(a(n.$refs.select2_ajax));if(n[e.model]&&n[e.model].length){n.loading=!0;const t=new FormData;n[e.model].forEach(o=>{t.append("ids[]",o)}),t.append("type",e.data_type),t.append("security",advanced_coupon_for_woocommerce_admin.nonce_get_dropdown_data),t.append("action","advanced_coupon_for_woocommerce/get_dropdown_data"),wp.hooks.doAction("advanced_coupon_for_woocommerce_preload_form_data",this,t),fetch(advanced_coupon_for_woocommerce_admin.ajax_url,{method:"POST",body:t}).then(o=>o.json()).then(o=>{1==o.success&&(n[e.hold_data]=o.data)}).finally(()=>{n.loading=!1})}}),wp.hooks.doAction("advanced_coupon_for_woocommerce_condition_preload",this)},...wp.hooks.applyFilters("advanced_coupon_for_woocommerce_condition_methods",{})}},...wp.hooks.applyFilters("advanced_coupon_for_woocommerce.discount_tier_item.components",{})},props:{rule:{type:Object},ruleNo:{type:Number,default:0}},data(){return Object.assign({id:n(),discount:"",private_note:"",collapsed:!1,disabled:!1,offer_type:"both",discount_type:"fixed_discount",condition_relationship:"match_all",conditions:[],title:advanced_coupon_for_woocommerce_admin.i10n.discount_tier+" "+(this.ruleNo+1),...wp.hooks.applyFilters("advanced_coupon_for_woocommerce.discount_tier_item.data",{})},this.rule)},beforeMount(){this.$root.$data.discount_tiers[this.ruleNo]=this.$data},beforeUpdate(){this.$root.$data.discount_tiers[this.ruleNo]=this.$data},computed:{is_free_shipping(){return this.$root.free_shipping}},methods:{duplicate_rule(o){if(3<=this.$root.discount_tiers.length&&!1===t)return this.$root.show_pro_notice();var o=JSON.parse(JSON.stringify(this.$root.discount_tiers[o])),e=o.title.length?o.title+" "+advanced_coupon_for_woocommerce_admin.i10n.copy_text:"";this.$root.discount_tiers.push({...o,id:n(),title:e})},delete_rule(){confirm(advanced_coupon_for_woocommerce_admin.i10n.delete_discount_tier_warning)&&this.$root.discount_tiers.splice(this.ruleNo,1)},move_up(){var o,e,t;0!=this.ruleNo&&(e=(o=this.$root.discount_tiers).splice(this.ruleNo,1)[0],t=this.ruleNo-1,o.splice(t,0,e))},move_down(){var o,e=this.$root.discount_tiers,t=this.ruleNo+1;t>=e.length||(o=e.splice(this.ruleNo,1)[0],e.splice(t,0,o))}}};const e=Vue.createApp({data(){return{discount_tiers:[],disabled:!1,start_after_date:"",free_shipping:!1,rule_import_coupon:null,show_locked_modal:!1,start_tiered_discount:"immediately",match_discount_tier_priority:"highest_discount"}},components:{"discount-tier-item":o},watch:{discount_tiers:{handler(o){0<o?.length?(a("#general_coupon_data #discount_type").prop("disabled",!0),a("#general_coupon_data #coupon_amount").prop("disabled",!0)):(a("#general_coupon_data #discount_type").prop("disabled",!1),a("#general_coupon_data #coupon_amount").prop("disabled",!1))},deep:!0}},mounted(){const e=this;this.reuse_methods(),this.set_data(a("#advanced-coupon-for-woocommerce").data("settings")),a(document).keyup(function(o){"Escape"===o.key&&(e.show_locked_modal=!1)})},updated(){this.reuse_methods()},computed:{get_json_data(){var o=JSON.parse(JSON.stringify(this.$data));delete o.free_shipping,delete o.rule_import_coupon,delete o.show_locked_modal;const t=Object.keys(advanced_coupon_for_woocommerce_admin.condition_ui_values);return t.push("id"),o.discount_tiers.forEach(o=>{delete o.id,Array.isArray(o.conditions)&&o.conditions.map(e=>{t.forEach(o=>{delete e[o]})})}),JSON.stringify(o)},has_import_rule_id(){return 0<parseInt(this.rule_import_coupon)}},methods:{has_pro(){return t},set_data(o){if("object"==typeof o)for(const e in o)this[e]=o[e]},add_new_discount_tier(){if(3<=this.discount_tiers.length&&!1===t)return this.show_pro_notice();this.discount_tiers.push({})},import_coupon_data(){var o=new FormData;o.append("coupon_id",this.rule_import_coupon),o.append("security",this.$refs.import_nonce.value),o.append("action","advanced_coupon_for_woocommerce/import_coupon_data"),fetch(advanced_coupon_for_woocommerce_admin.ajax_url,{method:"POST",body:o}).then(o=>o.json()).then(o=>{this.set_data(o.data)})},show_pro_notice(){this.show_locked_modal=!0},reuse_methods(){const o=this;a(this.$refs.import_tiered_discount_rule).select2({placeholder:a(this).data("placeholder"),ajax:{url:advanced_coupon_for_woocommerce_admin.ajax_url,dataType:"json",type:"POST",data:function(o){return{type:"coupon_rules",term:o.term,security:advanced_coupon_for_woocommerce_admin.nonce_get_dropdown_data,action:"advanced_coupon_for_woocommerce/get_dropdown_data"}},processResults:function(o){return{results:a.map(o.data,function(o){return{text:o.name,id:o.id}})}}}}).on("change",function(){o.rule_import_coupon=a(this).val()})}}}).mount("#advanced-coupon-for-woocommerce");a("#free_shipping").on("change",function(){e.free_shipping=a(this).is(":checked")}).trigger("change")}(jQuery); -
advanced-coupon-for-woocommerce/trunk/inc/class-condition-cart.php
r3202052 r3400976 41 41 $compare_value = 0.00; 42 42 if ('cart:subtotal' === $condition['type']) { 43 $compare_value = (float) WC()->cart->get_subtotal();43 $compare_value = Utils::get_cart_subtotal(); 44 44 } 45 45 -
advanced-coupon-for-woocommerce/trunk/inc/class-main.php
r3400212 r3400976 98 98 add_action('admin_notices', array($this, 'disabled_coupon_feature')); 99 99 add_filter('plugin_action_links', array($this, 'add_plugin_links'), 10, 2); 100 //add_filter('woocommerce_coupon_get_discount_amount', array($this, 'woocommerce_get_shop_coupon_data'), 200, 5);101 add_ action('woocommerce_cart_calculate_fees', array($this, 'update_coupon_discount'), 20000);100 add_filter('woocommerce_coupon_get_amount', array($this, 'woocommerce_get_shop_coupon_data'), 200, 2); 101 add_filter('woocommerce_coupon_get_discount_type', array($this, 'handle_coupon_discount_type'), 10, 2); 102 102 } 103 103 … … 147 147 * @return float 148 148 */ 149 public function woocommerce_get_shop_coupon_data($discount, $discounting_amount, $cart_item, $single, $coupon) { 150 if (!is_a($coupon, 'WC_Coupon')) { 151 return $discount; 152 } 153 149 public function woocommerce_get_shop_coupon_data($amount, $coupon) { 154 150 if (is_admin()) { 155 return $ discount;151 return $amount; 156 152 } 157 153 158 154 $matched_tier = Utils::get_matched_tier($coupon->get_id()); 159 155 if (false === $matched_tier) { 160 return $ discount;156 return $amount; 161 157 } 162 158 … … 166 162 $allow_discount = true; 167 163 } 164 165 if ('product_only' == $matched_tier['offer_type']) { 166 return 0; 167 } 168 168 } 169 169 170 170 if (!$allow_discount) { 171 return $discount; 172 } 173 174 $new_discount = floatval($matched_tier['discount']); 175 if ('fixed_discount' === $matched_tier['discount_type']) { 176 return $new_discount; 177 } 178 171 return $amount; 172 } 173 174 return floatval($matched_tier['discount']); 175 } 176 177 /** 178 * Update coupon discount type 179 * 180 * @since 1.1.1 181 * @return string 182 */ 183 public function handle_coupon_discount_type($type, $coupon) { 184 $matched_tier = Utils::get_matched_tier($coupon->get_id()); 185 if (false === $matched_tier) { 186 return $type; 187 } 188 189 $allow_discount = false; 190 if (isset($matched_tier['offer_type'])) { 191 if (empty($matched_tier['offer_type']) || 'both' == $matched_tier['offer_type'] || 'discount_only' == $matched_tier['offer_type']) { 192 $allow_discount = true; 193 } 194 } 195 196 if (!$allow_discount) { 197 return $type; 198 } 199 200 $type = 'fixed_cart'; 179 201 if ('percentage_discount' === $matched_tier['discount_type']) { 180 if ($new_discount <= 0) { 181 return 0; 182 } 183 184 $subtotal = (float) WC()->cart->get_subtotal(); 185 return floatval($subtotal * $new_discount / 100); 186 } 187 188 return $discount; 189 } 190 191 /** 192 * Update coupon discount 193 * 194 * @since 1.1.0 195 * @return void 196 */ 197 public function update_coupon_discount() { 198 foreach (WC()->cart->get_coupons() as $code => $coupon) { 199 200 $matched_tier = Utils::get_matched_tier($coupon->get_id()); 201 if (false === $matched_tier) { 202 continue; 203 } 204 205 $allow_discount = false; 206 if (isset($matched_tier['offer_type'])) { 207 if (empty($matched_tier['offer_type']) || 'both' == $matched_tier['offer_type'] || 'discount_only' == $matched_tier['offer_type']) { 208 $allow_discount = true; 209 } 210 } 211 212 if (!$allow_discount) { 213 continue; 214 } 215 216 $new_discount = floatval($matched_tier['discount']); 217 218 if ('percentage_discount' === $matched_tier['discount_type']) { 219 if ($new_discount <= 0) { 220 $new_discount = 0; 221 } else { 222 $subtotal = (float) WC()->cart->get_subtotal(); 223 $new_discount = floatval($subtotal * $new_discount / 100); 224 } 225 } 226 227 WC()->cart->coupon_discount_totals[$code] = $new_discount; 228 //WC()->cart->add_fee('Coupon: ' . $code, -$new_discount); 229 } 202 $type = 'percent'; 203 } 204 205 return $type; 230 206 } 231 207 } -
advanced-coupon-for-woocommerce/trunk/inc/class-utils.php
r3381120 r3400976 431 431 432 432 /** 433 * Get cart subtotal 434 * 435 * @since 1.0.9 436 * @return array 437 */ 438 public static function get_cart_subtotal() { 439 $subtotal = WC()->cart->get_subtotal(); 440 if (get_option('woocommerce_tax_display_cart') === 'incl') { 441 $subtotal = WC()->cart->get_subtotal() + WC()->cart->get_subtotal_tax(); 442 } 443 444 return (float) $subtotal; 445 } 446 447 /** 433 448 * Get matched coupon tier 434 449 * -
advanced-coupon-for-woocommerce/trunk/readme.txt
r3400212 r3400976 4 4 Requires at least: 4.3 5 5 Tested up to: 6.8 6 Stable tag: 1.1. 06 Stable tag: 1.1.1 7 7 License: GPLv3 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 47 47 Activate coupons only during certain times or days, such as weekends, holidays, or flash sales. 48 48 49 **5. Auto Application at Checkout**50 Once the conditions are met, the discount is applied automatically. No manual code entry is needed for customers.49 **5. Free Product Coupon (Pro Version) 50 Reward customers instantly by offering free products when they apply a coupon. The Pro version allows you to attach a product to any coupon—when the coupon is applied, the product is automatically added to the cart. Perfect for "Buy X Get Y Free" promotions or special giveaway campaigns. 51 51 52 52 == Installation == … … 79 79 80 80 == Changelog == 81 82 = 1.1.1 = 83 * Added a filter to adjust the coupon discount type for accurate calculation 81 84 82 85 = 1.1.0 =
Note: See TracChangeset
for help on using the changeset viewer.