Changeset 3424553
- Timestamp:
- 12/21/2025 10:21:19 AM (3 months ago)
- Location:
- woo-additional-fees-on-checkout-wordpress
- Files:
-
- 20 added
- 1 deleted
- 7 edited
-
tags/1.5.1 (deleted)
-
tags/1.5.3 (added)
-
tags/1.5.3/assets (added)
-
tags/1.5.3/assets/css (added)
-
tags/1.5.3/assets/css/admin-style.css (added)
-
tags/1.5.3/assets/css/style.css (added)
-
tags/1.5.3/assets/css/wafc-select2.min.css (added)
-
tags/1.5.3/assets/js (added)
-
tags/1.5.3/assets/js/wafc-select2.min.js (added)
-
tags/1.5.3/assets/js/wps-ext-cst.js (added)
-
tags/1.5.3/classes (added)
-
tags/1.5.3/classes/wps-ext-cst-admin-settings.php (added)
-
tags/1.5.3/classes/wps-ext-cst-admin.php (added)
-
tags/1.5.3/classes/wps-ext-cst-extra-fees-frontend.php (added)
-
tags/1.5.3/classes/wps-ext-cst-frontend.php (added)
-
tags/1.5.3/classes/wps-ext-cst-main.php (added)
-
tags/1.5.3/readme.txt (added)
-
tags/1.5.3/woo-additional-fees-checkout.php (added)
-
tags/1.5.3/woocommerce (added)
-
tags/1.5.3/woocommerce/checkout (added)
-
tags/1.5.3/woocommerce/checkout/review-order.php (added)
-
trunk/classes/wps-ext-cst-admin-settings.php (modified) (24 diffs)
-
trunk/classes/wps-ext-cst-admin.php (modified) (10 diffs)
-
trunk/classes/wps-ext-cst-extra-fees-frontend.php (modified) (3 diffs)
-
trunk/classes/wps-ext-cst-frontend.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woo-additional-fees-checkout.php (modified) (4 diffs)
-
trunk/woocommerce/checkout/review-order.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-additional-fees-on-checkout-wordpress/trunk/classes/wps-ext-cst-admin-settings.php
r3418398 r3424553 5 5 add_settings_section("wps-ext-cst-option-section", "Additional Fees Settings", null, "wps-ext-cst-options"); 6 6 7 register_setting("wps-ext-cst-option-section", "ext_cst_status"); 8 register_setting("wps-ext-cst-option-section", "ext_cst_label"); 9 register_setting("wps-ext-cst-option-section", "ext_cst_label_billing"); 10 register_setting("wps-ext-cst-option-section", "ext_cst_amount_type"); 11 register_setting("wps-ext-cst-option-section", "ext_cst_amount"); 12 register_setting("wps-ext-cst-option-section", "ext_cst_label_css"); 13 register_setting("wps-ext-cst-option-section", "ext_cst_inc_ship_costs"); 14 register_setting("wps-ext-cst-option-section", "ext_cst_inc_tax"); 15 16 17 18 19 register_setting("wps-ext-cst-option-section", "ext_cst_extra"); 20 7 $text_args = array( 8 'type' => 'string', 9 'sanitize_callback' => 'sanitize_text_field', 10 'default' => NULL, 11 ); 12 $number_args = array( 13 'type' => 'number', 14 'sanitize_callback' => 'floatval', 15 'default' => NULL, 16 ); 17 register_setting("wps-ext-cst-option-section", "ext_cst_status", $text_args); 18 register_setting("wps-ext-cst-option-section", "ext_cst_label", $text_args); 19 register_setting("wps-ext-cst-option-section", "ext_cst_label_billing", $text_args); 20 register_setting("wps-ext-cst-option-section", "ext_cst_amount_type", $text_args); 21 register_setting("wps-ext-cst-option-section", "ext_cst_amount", $number_args); 22 register_setting("wps-ext-cst-option-section", "ext_cst_label_css", $text_args); 23 register_setting("wps-ext-cst-option-section", "ext_cst_inc_ship_costs", $text_args ); 24 register_setting("wps-ext-cst-option-section", "ext_cst_inc_tax", $text_args); 25 26 27 28 29 register_setting("wps-ext-cst-option-section", "ext_cst_extra", 30 array( 31 'type'=>'array', 32 'sanitize_callback'=>array('WPS_EXT_CST_Admin_Settings','wps_wafc_sanitize_extra_option'), 33 'default' => NULL 34 ) 35 ); 36 37 } 38 public static function wps_wafc_sanitize_extra_option($settings){ 39 return $settings; 21 40 } 22 41 public static function admin_settings(){ … … 47 66 <tbody> 48 67 <tr> 49 <th scope="row"><label><?php _e( 'Status'); ?></label></th>68 <th scope="row"><label><?php echo esc_html(__( 'Status','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 50 69 <td> 51 70 <select name="ext_cst_status" id="ext_cst_status"> … … 56 75 </tr> 57 76 <tr> 58 <th scope="row"><label><?php _e( 'Label'); ?></label></th>59 <td> 60 <input type="text" name="ext_cst_label" class="regular-text code" id="ext_cst_label" value="<?php echo $ext_cst_label; ?>"/>61 </td> 62 </tr> 63 <tr> 64 <th scope="row"><label><?php _e( 'Label for Billing'); ?></label></th>65 <td> 66 <input type="text" name="ext_cst_label_billing" class="regular-text code" id="ext_cst_label_billing" value="<?php echo $ext_cst_label_billing; ?>"/>67 </td> 68 </tr> 69 <tr> 70 <th scope="row"><label><?php _e( 'Type'); ?></label></th>77 <th scope="row"><label><?php echo esc_html(__( 'Label','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 78 <td> 79 <input type="text" name="ext_cst_label" class="regular-text code" id="ext_cst_label" value="<?php echo esc_html($ext_cst_label); ?>"/> 80 </td> 81 </tr> 82 <tr> 83 <th scope="row"><label><?php echo esc_html(__( 'Label for Billing','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 84 <td> 85 <input type="text" name="ext_cst_label_billing" class="regular-text code" id="ext_cst_label_billing" value="<?php echo esc_html($ext_cst_label_billing); ?>"/> 86 </td> 87 </tr> 88 <tr> 89 <th scope="row"><label><?php echo esc_html(__( 'Type','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 71 90 <td> 72 91 <select name="ext_cst_amount_type" id="ext_cst_amount_type" onchange="showHideTaxShipping(this,1)"> … … 77 96 </tr> 78 97 <tr id="incTax-1" class="incTax"> 79 <th scope="row"><label><?php _e( 'Calculate fees including TAX'); ?></label></th>98 <th scope="row"><label><?php echo esc_html(__( 'Calculate fees including TAX','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 80 99 <td> 81 100 <select name="ext_cst_inc_tax" id="ext_cst_inc_tax"> … … 86 105 </tr> 87 106 <tr id="incShipCosts-1" class="incShipCosts"> 88 <th scope="row"><label><?php _e( 'Calculate fees including Shipping Costs'); ?></label></th>107 <th scope="row"><label><?php echo esc_html(__( 'Calculate fees including Shipping Costs','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 89 108 <td> 90 109 <select name="ext_cst_inc_ship_costs" id="ext_cst_inc_ship_costs"> … … 95 114 </tr> 96 115 <tr> 97 <th scope="row"><label><?php _e( 'Amount'); ?></label></th>98 <td> 99 <input type="number" step="any" name="ext_cst_amount" class="fees_amount regular-text code" id="ext_cst_amount" value="<?php echo $ext_cst_amount; ?>"/>100 </td> 101 </tr> 102 <tr> 103 <th scope="row"><label><?php _e( 'Apply Condition'); ?></label></th>116 <th scope="row"><label><?php echo esc_html(__( 'Amount','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 117 <td> 118 <input type="number" step="any" name="ext_cst_amount" class="fees_amount regular-text code" id="ext_cst_amount" value="<?php echo esc_html($ext_cst_amount); ?>"/> 119 </td> 120 </tr> 121 <tr> 122 <th scope="row"><label><?php echo esc_html(__( 'Apply Condition','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 104 123 <td> 105 124 <select data-id="1" class="ext_cst_cndtn_dropdown" name="ext_cst_apply_type" id="ext_cst_apply_type"> … … 113 132 <tr> 114 133 <th scope="row"> 115 <label><?php _e( 'Auto-checked/Auto-applied the fees'); ?></label>134 <label><?php echo esc_html(__( 'Auto-checked/Auto-applied the fees','woo-additional-fees-on-checkout-wordpress')); ?></label> 116 135 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 117 136 </th> … … 125 144 </tr> 126 145 <tr> 127 <th scope="row"><label><?php _e( 'Condition'); ?></label></th>146 <th scope="row"><label><?php echo esc_html(__( 'Condition','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 128 147 <td> 129 148 <select data-id="1" class="ext_cst_cndtn_dropdown" name="ext_cst_apply_cndtn" id="ext_cst_apply_cndtn" onchange="show_hide_cndtn()"> … … 141 160 <tr> 142 161 <th scope="row"> 143 <label><?php _e( 'Required Field'); ?></label>162 <label><?php echo esc_html(__( 'Required Field','woo-additional-fees-on-checkout-wordpress')); ?></label> 144 163 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 145 164 </th> … … 154 173 <tr> 155 174 <th scope="row"> 156 <label><?php _e( 'Hide Option At Checkout'); ?></label>175 <label><?php echo esc_html(__( 'Hide Option At Checkout','woo-additional-fees-on-checkout-wordpress')); ?></label> 157 176 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 158 177 </th> … … 166 185 </tr> 167 186 <tr> 168 <th scope="row"><label><?php _e( 'Custom CSS'); ?></label></th>169 <td> 170 <textarea class="large-text code" name="ext_cst_label_css" id="ext_cst_label_css"><?php echo $ext_cst_label_css; ?></textarea>187 <th scope="row"><label><?php echo esc_html(__( 'Custom CSS','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 188 <td> 189 <textarea class="large-text code" name="ext_cst_label_css" id="ext_cst_label_css"><?php echo esc_attr($ext_cst_label_css); ?></textarea> 171 190 </td> 172 191 </tr> … … 176 195 <div id="wps_custom_fees_add_more" style="width: 50%; margin-left: auto; margin-right: auto;"> 177 196 <?php 178 197 $option = 0; 179 198 if(is_array($extra_options) && !empty($extra_options)){ 180 199 $count = 2; … … 186 205 //echo '<pre>'; print_r($value['selected_product_id_extra']); echo "</pre>"; 187 206 ?> 188 <div class="wps-ext-cst-fees" id="fees<?php echo $option; ?>">207 <div class="wps-ext-cst-fees" id="fees<?php echo esc_html($option); ?>"> 189 208 <h3 style="border-bottom: 1px solid black;"> 190 <span class="fees-title"><?php echo $value['label'] ? $value['label']: ' Unlabelled Fees';?></span>191 <span style="float:right; color:red; cursor: pointer;" class="dashicons dashicons-trash" onclick="remove_fees(<?php echo $option; ?>)"></span>209 <span class="fees-title"><?php echo esc_html($value['label']) ? esc_html($value['label']) : ' Unlabelled Fees';?></span> 210 <span style="float:right; color:red; cursor: pointer;" class="dashicons dashicons-trash" onclick="remove_fees(<?php echo esc_html($option); ?>)"></span> 192 211 </h3> 193 212 <table class="form-table"> 194 213 <tbody> 195 214 <tr> 196 <th scope="row"><label><?php _e( 'Status'); ?><label></th>197 <td> 198 <select name="ext_cst_extra[<?php echo $option; ?>][status]" id="ext_cst_status_extra">215 <th scope="row"><label><?php echo esc_html(__( 'Status','woo-additional-fees-on-checkout-wordpress')); ?><label></th> 216 <td> 217 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][status]" id="ext_cst_status_extra"> 199 218 <option value="enable" <?php if($value['status']=='enable'){ echo 'selected=selected';} ?>>Enable</option> 200 219 <option value="disable" <?php if($value['status']=='disable'){ echo 'selected=selected';} ?>>Disable</option> … … 203 222 </tr> 204 223 <tr> 205 <th scope="row"><label><?php _e( 'Label'); ?></labe></td>206 <td> 207 <input type="text" name="ext_cst_extra[<?php echo $option; ?>][label]" class="regular-text code" id="ext_cst_label_extra" value="<?php echo $value['label']?>"/>208 </td> 209 </tr> 210 <tr> 211 <th scope="row"><label><?php _e( 'Label for Billing'); ?></labe></td>212 <td> 213 <input type="text" name="ext_cst_extra[<?php echo $option; ?>][label_billing]" class="regular-text code" id="ext_cst_label_billing_extra" value="<?php echo $value['label_billing']?>"/>214 </td> 215 </tr> 216 <tr> 217 <th scope="row"><label><?php _e( 'Type'); ?><label></th>218 <td> 219 <select name="ext_cst_extra[<?php echo $option; ?>][amount_type]" id="ext_cst_amount_type_extra" onchange="showHideTaxShipping(this,<?php echo $option; ?>)">224 <th scope="row"><label><?php echo esc_html(__( 'Label','woo-additional-fees-on-checkout-wordpress')); ?></labe></td> 225 <td> 226 <input type="text" name="ext_cst_extra[<?php echo esc_html($option); ?>][label]" class="regular-text code" id="ext_cst_label_extra" value="<?php echo esc_html($value['label']) ?>"/> 227 </td> 228 </tr> 229 <tr> 230 <th scope="row"><label><?php echo esc_html(__( 'Label for Billing','woo-additional-fees-on-checkout-wordpress')); ?></labe></td> 231 <td> 232 <input type="text" name="ext_cst_extra[<?php echo esc_html($option); ?>][label_billing]" class="regular-text code" id="ext_cst_label_billing_extra" value="<?php echo esc_html($value['label_billing']); ?>"/> 233 </td> 234 </tr> 235 <tr> 236 <th scope="row"><label><?php echo esc_html(__( 'Type','woo-additional-fees-on-checkout-wordpress')); ?><label></th> 237 <td> 238 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][amount_type]" id="ext_cst_amount_type_extra" onchange="showHideTaxShipping(this,<?php echo esc_html($option); ?>)"> 220 239 <option value="fixed" <?php if($value['amount_type']=='fixed'){ echo 'selected=selected';} ?>>Fixed</option> 221 240 <option value="percent" <?php if($value['amount_type']=='percent'){ echo 'selected=selected';} ?>>Percentage</option> … … 223 242 </td> 224 243 </tr> 225 <tr id="incTax-<?php echo $option; ?>" class="incTax">226 <th scope="row"><label><?php _e( 'Calculate fees including TAX'); ?></label></th>227 <td> 228 <select name="ext_cst_extra[<?php echo $option; ?>][inc_tax]" id="ext_cst_inc_tax_extra">244 <tr id="incTax-<?php echo esc_html($option); ?>" class="incTax"> 245 <th scope="row"><label><?php echo esc_html(__( 'Calculate fees including TAX','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 246 <td> 247 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][inc_tax]" id="ext_cst_inc_tax_extra"> 229 248 <option value="yes" <?php if(isset($value['inc_tax']) && $value['inc_tax']=='yes'){echo 'selected';} ?>>Yes</option> 230 249 <option value="no" <?php if(isset($value['inc_tax']) && $value['inc_tax']=='no'){echo 'selected';} ?>>No</option> … … 232 251 </td> 233 252 </tr> 234 <tr id="incShipCosts-<?php echo $option; ?>" class="incShipCosts">235 <th scope="row"><label><?php _e( 'Calculate fees including Shipping Costs'); ?></label></th>236 <td> 237 <select name="ext_cst_extra[<?php echo $option; ?>][inc_ship_costs]" id="ext_cst_inc_ship_costs_extra">253 <tr id="incShipCosts-<?php echo esc_html($option); ?>" class="incShipCosts"> 254 <th scope="row"><label><?php echo esc_html(__( 'Calculate fees including Shipping Costs','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 255 <td> 256 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][inc_ship_costs]" id="ext_cst_inc_ship_costs_extra"> 238 257 <option value="yes" <?php if(isset($value['inc_ship_costs']) && $value['inc_ship_costs']=='yes'){echo 'selected';} ?>>Yes</option> 239 258 <option value="no" <?php if(isset($value['inc_ship_costs']) && $value['inc_ship_costs']=='no'){echo 'selected';} ?>>No</option> … … 242 261 </tr> 243 262 <tr> 244 <th scope="row"><label><?php _e( 'Amount'); ?></labe></td>245 <td> 246 <input type="number" step="any" name="ext_cst_extra[<?php echo $option; ?>][amount]" class="fees_amount regular-text code" id="ext_cst_amount_extra<?php echo $option; ?>" value="<?php echo $value['amount']?>"/>247 </td> 248 </tr> 249 <tr> 250 <th scope="row"><label><?php _e( 'Apply Condition'); ?></label></th>251 <td> 252 <select name="ext_cst_extra[<?php echo $option; ?>][apply_type]" id="ext_cst_apply_type<?php echo $option; ?>">263 <th scope="row"><label><?php echo esc_html(__( 'Amount','woo-additional-fees-on-checkout-wordpress')); ?></labe></td> 264 <td> 265 <input type="number" step="any" name="ext_cst_extra[<?php echo number_format($option); ?>][amount]" class="fees_amount regular-text code" id="ext_cst_amount_extra<?php echo esc_html($option); ?>" value="<?php echo esc_html($value['amount']); ?>"/> 266 </td> 267 </tr> 268 <tr> 269 <th scope="row"><label><?php echo esc_html(__( 'Apply Condition','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 270 <td> 271 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][apply_type]" id="ext_cst_apply_type<?php echo esc_html($option); ?>"> 253 272 <option value="one_time">One Time Only</option> 254 273 <option value="multiply">Multiplied By Product Quantity</option> … … 260 279 <tr> 261 280 <th scope="row"> 262 <label><?php _e( 'Auto-checked/Auto-applied the fees'); ?><label>281 <label><?php echo esc_html(__( 'Auto-checked/Auto-applied the fees','woo-additional-fees-on-checkout-wordpress')); ?><label> 263 282 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 264 283 </th> 265 284 <td> 266 <select name="ext_cst_extra[<?php echo $option; ?>][auto_checked]" id="ext_cst_auto_checked_extra">285 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][auto_checked]" id="ext_cst_auto_checked_extra"> 267 286 <option value="enable">Enable</option> 268 287 <option value="disable">Disable</option> … … 272 291 </tr> 273 292 <tr> 274 <th scope="row"><label><?php _e( 'Condition'); ?><label></th>275 <td> 276 <select data-id="<?php echo $option; ?>" class="ext_cst_cndtn_dropdown" name="ext_cst_extra[<?php echo $option; ?>][apply_cndtn]" id="ext_cst_apply_cndtn_extra<?php echo $option; ?>" onchange="show_hide_cndtn_extra(<?php echo $option; ?>)">293 <th scope="row"><label><?php echo esc_html(__( 'Condition','woo-additional-fees-on-checkout-wordpress')); ?><label></th> 294 <td> 295 <select data-id="<?php echo esc_html($option); ?>" class="ext_cst_cndtn_dropdown" name="ext_cst_extra[<?php echo esc_html($option); ?>][apply_cndtn]" id="ext_cst_apply_cndtn_extra<?php echo esc_html($option); ?>" onchange="show_hide_cndtn_extra(<?php echo esc_html($option); ?>)"> 277 296 <option value="all">All</option> 278 297 <option>Cart Total Amount</option> … … 288 307 <tr> 289 308 <th scope="row"> 290 <label><?php _e( 'Required Field'); ?></labe>309 <label><?php echo esc_html(__( 'Required Field','woo-additional-fees-on-checkout-wordpress')); ?></labe> 291 310 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 292 311 </th> 293 312 <td> 294 <select name="ext_cst_extra[<?php echo $option; ?>][ext_cst_is_required_extra]" name="" id="ext_cst_is_required_extra">313 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][ext_cst_is_required_extra]" name="" id="ext_cst_is_required_extra"> 295 314 <option value="no">No</option> 296 315 <option value="yes">Yes</option> … … 301 320 <tr> 302 321 <th scope="row"> 303 <label><?php _e( 'Hide Option At Checkout'); ?></label>322 <label><?php echo esc_html(__( 'Hide Option At Checkout','woo-additional-fees-on-checkout-wordpress')); ?></label> 304 323 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 305 324 </th> 306 325 <td> 307 <select name="ext_cst_extra[<?php echo $option; ?>][hide_on_frontend]" id="ext_cst_hide_on_frontend<?php echo $option; ?>">326 <select name="ext_cst_extra[<?php echo esc_html($option); ?>][hide_on_frontend]" id="ext_cst_hide_on_frontend<?php echo esc_html($option); ?>"> 308 327 <option value="no">No</option> 309 328 <option value="yes">Yes</option> … … 316 335 </div> 317 336 <script type="text/javascript"> 318 show_hide_cndtn_extra(<?php echo $option; ?>);337 show_hide_cndtn_extra(<?php echo esc_html($option); ?>); 319 338 function show_hide_cndtn_extra(s_id){ 320 339 jQuery(".cndtn_mode_extra"+s_id).hide(); … … 323 342 jQuery("#"+id+s_id).show(); 324 343 } 325 var type_value = jQuery("select[name='ext_cst_extra[<?php echo $option; ?>][amount_type]']").val();344 var type_value = jQuery("select[name='ext_cst_extra[<?php echo esc_html($option); ?>][amount_type]']").val(); 326 345 if( type_value == 'percent' ){ 327 jQuery('#incTax-<?php echo $option; ?>').show();328 jQuery('#incShipCosts-<?php echo $option; ?>').show();346 jQuery('#incTax-<?php echo esc_html($option); ?>').show(); 347 jQuery('#incShipCosts-<?php echo esc_html($option); ?>').show(); 329 348 }else{ 330 jQuery('#incTax-<?php echo $option; ?>').hide();331 jQuery('#incShipCosts-<?php echo $option; ?>').hide();349 jQuery('#incTax-<?php echo esc_html($option); ?>').hide(); 350 jQuery('#incShipCosts-<?php echo esc_html($option); ?>').hide(); 332 351 } 333 352 … … 340 359 341 360 ?> 342 <input type="hidden" id="current_number_fees" value="<?php echo $option; ?>" />361 <input type="hidden" id="current_number_fees" value="<?php echo esc_html($option); ?>" /> 343 362 </div> 344 363 <div class="wafoc-bottom-line" style="width: 100%; height: 50px;"> -
woo-additional-fees-on-checkout-wordpress/trunk/classes/wps-ext-cst-admin.php
r3418398 r3424553 13 13 } 14 14 public static function add_menu_extra_fee_option() { 15 $setting_menu_create = add_submenu_page( 'woocommerce' , __( 'Additional Fees' ), __( 'Additional Fees' ), 'manage_options', 'wps-ext-cst-option', array(15 $setting_menu_create = add_submenu_page( 'woocommerce' , __( 'Additional Fees','woo-additional-fees-on-checkout-wordpress'), __( 'Additional Fees','woo-additional-fees-on-checkout-wordpress' ), 'manage_options', 'wps-ext-cst-option', array( 16 16 'WPS_EXT_CST_Admin_Settings','admin_settings')); 17 17 } … … 27 27 ?> 28 28 29 <div class="wps-ext-cst-fees" id="fees<?php echo $_POST['number'];?>">29 <div class="wps-ext-cst-fees" id="fees<?php echo number_format(number_format($_POST['number']));?>"> 30 30 <h3 style="border-bottom: 1px solid black;"> 31 31 <span class="fees-title">Unlabelled Fees</span> 32 <span style="float:right; color:red; cursor: pointer;" class="dashicons dashicons-trash" onclick="remove_fees(<?php echo $_POST['number'];?>)"></span>32 <span style="float:right; color:red; cursor: pointer;" class="dashicons dashicons-trash" onclick="remove_fees(<?php echo number_format(number_format($_POST['number']));?>)"></span> 33 33 </h3> 34 34 <table class="form-table"> 35 35 <tbody> 36 36 <tr> 37 <th scope="row"><label><?php _e( 'Status'); ?><label></th>37 <th scope="row"><label><?php echo esc_html(__( 'Status','woo-additional-fees-on-checkout-wordpress')); ?><label></th> 38 38 <td> 39 <select name="ext_cst_extra[<?php echo $_POST['number'];?>][status]" id="ext_cst_status_extra">39 <select name="ext_cst_extra[<?php echo number_format(number_format($_POST['number']));?>][status]" id="ext_cst_status_extra"> 40 40 <option value="enable">Enable</option> 41 41 <option value="disable">Disable</option> … … 44 44 </tr> 45 45 <tr> 46 <th scope="row"><label><?php _e( 'Label'); ?></labe></td>46 <th scope="row"><label><?php echo esc_html(__( 'Label','woo-additional-fees-on-checkout-wordpress')); ?></labe></td> 47 47 <td> 48 <input type="text" name="ext_cst_extra[<?php echo $_POST['number'];?>][label]" class="regular-text code" id="ext_cst_label_extra" value="<?php echo 'Unlabelled Fees #'.$_POST['number'];?>"/>48 <input type="text" name="ext_cst_extra[<?php echo number_format($_POST['number']);?>][label]" class="regular-text code" id="ext_cst_label_extra" value="<?php echo 'Unlabelled Fees #'.number_format($_POST['number']);?>"/> 49 49 </td> 50 50 </tr> 51 51 <tr> 52 <th scope="row"><label><?php _e( 'Label for Billing'); ?></labe></td>52 <th scope="row"><label><?php echo esc_html(__( 'Label for Billing','woo-additional-fees-on-checkout-wordpress')); ?></labe></td> 53 53 <td> 54 <input type="text" name="ext_cst_extra[<?php echo $_POST['number'];?>][label_billing]" class="regular-text code" id="ext_cst_label_billing_extra" value="Unlabelled Fees #<?php echo $_POST['number'];?>"/>54 <input type="text" name="ext_cst_extra[<?php echo number_format($_POST['number']);?>][label_billing]" class="regular-text code" id="ext_cst_label_billing_extra" value="Unlabelled Fees #<?php echo number_format($_POST['number']);?>"/> 55 55 </td> 56 56 </tr> 57 57 <tr> 58 <th scope="row"><label><?php _e( 'Type'); ?><label></th>58 <th scope="row"><label><?php echo esc_html(__( 'Type','woo-additional-fees-on-checkout-wordpress')); ?><label></th> 59 59 <td> 60 <select name="ext_cst_extra[<?php echo $_POST['number'];?>][amount_type]" id="ext_cst_amount_type_extra" onchange="showHideTaxShipping(this,<?php echo $_POST['number'];?>)">60 <select name="ext_cst_extra[<?php echo number_format($_POST['number']);?>][amount_type]" id="ext_cst_amount_type_extra" onchange="showHideTaxShipping(this,<?php echo number_format($_POST['number']);?>)"> 61 61 <option value="fixed">Fixed</option> 62 62 <option value="percent">Percentage</option> … … 64 64 </td> 65 65 </tr> 66 <tr id="incTax-<?php echo $_POST['number']; ?>" class="incTax" style="display:none;">67 <th scope="row"><label><?php _e( 'Calculate fees including TAX'); ?></label></th>66 <tr id="incTax-<?php echo number_format($_POST['number']); ?>" class="incTax" style="display:none;"> 67 <th scope="row"><label><?php echo esc_html(__( 'Calculate fees including TAX','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 68 68 <td> 69 <select name="ext_cst_extra[<?php echo $_POST['number']; ?>][inc_tax]" id="ext_cst_inc_tax_extra">69 <select name="ext_cst_extra[<?php echo number_format($_POST['number']); ?>][inc_tax]" id="ext_cst_inc_tax_extra"> 70 70 <option value="no">No</option> 71 71 <option value="yes">Yes</option> … … 73 73 </td> 74 74 </tr> 75 <tr id="incShipCosts-<?php echo $_POST['number']; ?>" class="incShipCosts" style="display:none;">76 <th scope="row"><label><?php _e( 'Calculate fees including Shipping Costs'); ?></label></th>75 <tr id="incShipCosts-<?php echo number_format($_POST['number']); ?>" class="incShipCosts" style="display:none;"> 76 <th scope="row"><label><?php echo esc_html(__( 'Calculate fees including Shipping Costs','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 77 77 <td> 78 <select name="ext_cst_extra[<?php echo $_POST['number']; ?>][inc_ship_costs]" id="ext_cst_inc_ship_costs_extra">78 <select name="ext_cst_extra[<?php echo number_format($_POST['number']); ?>][inc_ship_costs]" id="ext_cst_inc_ship_costs_extra"> 79 79 <option value="no">No</option> 80 80 <option value="yes">Yes</option> … … 83 83 </tr> 84 84 <tr> 85 <th scope="row"><label><?php _e( 'Amount'); ?></labe></td>85 <th scope="row"><label><?php echo esc_html(__( 'Amount','woo-additional-fees-on-checkout-wordpress')); ?></labe></td> 86 86 <td> 87 <input type="number" step="any" name="ext_cst_extra[<?php echo $_POST['number'];?>][amount]" class="fees_amount regular-text code" id="ext_cst_amount_extra<?php echo $_POST['number'];?>" value="1"/>87 <input type="number" step="any" name="ext_cst_extra[<?php echo number_format($_POST['number']);?>][amount]" class="fees_amount regular-text code" id="ext_cst_amount_extra<?php echo number_format($_POST['number']);?>" value="1"/> 88 88 </td> 89 89 </tr> 90 90 <tr> 91 <th scope="row"><label><?php _e( 'Apply Condition'); ?></label></th>91 <th scope="row"><label><?php echo esc_html(__( 'Apply Condition','woo-additional-fees-on-checkout-wordpress')); ?></label></th> 92 92 <td> 93 <select name="ext_cst_extra[<?php echo $_POST['number']; ?>][apply_type]" id="ext_cst_apply_type<?php echo $_POST['number']; ?>">93 <select name="ext_cst_extra[<?php echo number_format($_POST['number']); ?>][apply_type]" id="ext_cst_apply_type<?php echo number_format($_POST['number']); ?>"> 94 94 <option value="one_time">One Time Only</option> 95 95 <option value="multiply">Multiplied By Product Quantity</option> … … 101 101 <tr> 102 102 <th scope="row"> 103 <label><?php _e( 'Auto-checked/Auto-applied the fees'); ?><label>103 <label><?php echo esc_html(__( 'Auto-checked/Auto-applied the fees','woo-additional-fees-on-checkout-wordpress' )); ?><label> 104 104 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 105 105 </th> 106 106 <td> 107 <select name="ext_cst_extra[<?php echo $_POST['number'];?>][auto_checked]" id="ext_cst_auto_checked_extra">107 <select name="ext_cst_extra[<?php echo number_format($_POST['number']);?>][auto_checked]" id="ext_cst_auto_checked_extra"> 108 108 <option value="disable">Disable</option> 109 109 <option value="enable">Enable</option> … … 113 113 </tr> 114 114 <tr> 115 <th scope="row"><label><?php _e( 'Condition'); ?><label></th>115 <th scope="row"><label><?php echo esc_html(__( 'Condition','woo-additional-fees-on-checkout-wordpress')); ?><label></th> 116 116 <td> 117 <select data-id="<?php echo $_POST['number'];?>" name="ext_cst_extra[<?php echo $_POST['number'];?>][apply_cndtn]" id="ext_cst_apply_cndtn_extra<?php echo $_POST['number'];?>" class="ext_cst_cndtn_dropdown" onchange="show_hide_cndtn_extra(<?php echo $_POST['number'];?>)">117 <select data-id="<?php echo number_format($_POST['number']);?>" name="ext_cst_extra[<?php echo number_format($_POST['number']);?>][apply_cndtn]" id="ext_cst_apply_cndtn_extra<?php echo number_format($_POST['number']);?>" class="ext_cst_cndtn_dropdown" onchange="show_hide_cndtn_extra(<?php echo number_format($_POST['number']);?>)"> 118 118 <option value="all">All</option> 119 119 <option value="cart_total_amount">Cart Total Amount</option> … … 129 129 <tr> 130 130 <th scope="row"> 131 <label><?php _e( 'Required Field'); ?></label>131 <label><?php echo esc_html(__( 'Required Field','woo-additional-fees-on-checkout-wordpress')); ?></label> 132 132 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 133 133 </th> 134 134 <td> 135 <select name="ext_cst_extra[<?php echo $_POST['number']; ?>][ext_cst_is_required_extra]" name="" id="ext_cst_is_required_extra">135 <select name="ext_cst_extra[<?php echo number_format($_POST['number']); ?>][ext_cst_is_required_extra]" name="" id="ext_cst_is_required_extra"> 136 136 <option value="no">No</option> 137 137 <option value="yes">Yes</option> … … 142 142 <tr> 143 143 <th scope="row"> 144 <label><?php _e( 'Hide Option At Checkout'); ?></label>144 <label><?php echo esc_html(__( 'Hide Option At Checkout','woo-additional-fees-on-checkout-wordpress')); ?></label> 145 145 <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p> 146 146 </th> 147 147 <td> 148 <select name="ext_cst_extra[<?php echo $_POST['number']; ?>][hide_on_frontend]" id="ext_cst_hide_on_frontend<?php echo $_POST['number']; ?>">148 <select name="ext_cst_extra[<?php echo number_format($_POST['number']); ?>][hide_on_frontend]" id="ext_cst_hide_on_frontend<?php echo number_format($_POST['number']); ?>"> 149 149 <option value="no">No</option> 150 150 <option value="yes">Yes</option> -
woo-additional-fees-on-checkout-wordpress/trunk/classes/wps-ext-cst-extra-fees-frontend.php
r3418398 r3424553 52 52 <script type="text/javascript"> 53 53 jQuery( document ).ready(function( $ ) { 54 $('#<?php echo $key; ?>').click(function(){54 $('#<?php echo esc_html($key); ?>').click(function(){ 55 55 jQuery('body').trigger('update_checkout'); 56 56 }); … … 80 80 $extra_final_cost = WPS_EXT_CST_Extra_Fees_Frontend::calculate_final_cost_extra($value); 81 81 82 echo '<div id="'. $field_id.'">';83 woocommerce_form_field( $key, array(82 echo '<div id="'.esc_html($field_id).'">'; 83 woocommerce_form_field( esc_html($key), array( 84 84 'type' => 'checkbox', 85 85 'class' => array('wps_ext_cst_label_extra_option form-row-wide'), 86 'label' => $label,87 'placeholder' => __(' ')86 'label' => esc_html($label), 87 'placeholder' => __('None','woo-additional-fees-on-checkout-wordpress') 88 88 ), $checkout->get_value( $key )); 89 echo "<input type='hidden' name='cost_amount_hidden_". $key."' value=".$extra_final_cost." />";89 echo "<input type='hidden' name='cost_amount_hidden_".esc_html($key)."' value=".number_format($extra_final_cost)." />"; 90 90 echo "</div>"; 91 91 } … … 133 133 134 134 } 135 public static function check_required_fees_extra(){ 136 $extra_options = get_option('ext_cst_extra'); 137 if(is_array($extra_options) && !empty($extra_options)){ 138 foreach ($extra_options as $option => $value) { 139 $status = $value['status'] ? $value['status'] : 'enable'; 140 $get_cndtn = WPS_EXT_CST_Extra_Fees_Frontend::get_extra_condition($value); 141 $is_required = ($value['ext_cst_is_required_extra']=='yes') ? true : false; 142 if( $status == 'enable' && !is_admin() && $get_cndtn && $is_required){ 143 $key = 'wps_ext_cst_label_extra_'.$option; 144 $label = $value['label'] ? $value['label'] : 'Unlabelled Fees'; 145 if ( ! $_POST[$key] ){ 146 wc_add_notice( __( '<b>'.$label.'</b> is a required field.' ), 'error' ); 147 } 148 } 149 } 150 } 151 152 } 135 153 136 154 137 public static function calculate_extra_costs( $cart ){ -
woo-additional-fees-on-checkout-wordpress/trunk/classes/wps-ext-cst-frontend.php
r3418398 r3424553 55 55 'label' => $ext_cst_label, 56 56 'value' => 158, 57 'placeholder' => __(' ')57 'placeholder' => __('None','woo-additional-fees-on-checkout-wordpress') 58 58 ), $checkout->get_value( 'wps_ext_cst_label' )); 59 echo "<input type='hidden' name='extra_cost_amount' value=". $final_cost." />";59 echo "<input type='hidden' name='extra_cost_amount' value=".number_format($final_cost)." />"; 60 60 echo '</div>'; 61 61 } … … 65 65 public static function calculate_final_cost($amount, $type){ 66 66 67 global $woocommerce; 67 68 $cost = $amount; 68 69 … … 112 113 </script> 113 114 <style> 114 <?php echo $ext_cst_label_css; ?>115 <?php echo esc_html($ext_cst_label_css); ?> 115 116 .wps_hide_me{ display: none !important; } 116 117 </style> -
woo-additional-fees-on-checkout-wordpress/trunk/readme.txt
r3418398 r3424553 2 2 Contributors: WPSuperiors, amitwpdeveloper 3 3 Tags: woocommerce extra cost, woocommerce additional cost, woocommerce checkout cost, woocommerce surcharge. 4 Requires at least: 3.0.15 Tested up to: 6. 76 Stable tag: 1.5. 24 Requires at least: 6.3 5 Tested up to: 6.9 6 Stable tag: 1.5.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 10 10 11 Create required/non-required multiple fees for WooCommerce checkout, apply as fixed/percentage cost upon cart quantity/amount/product/category/type. … … 122 123 123 124 == Changelog == 125 = 1.5.3 - 21th Dec, 2025 = 126 *Compatibility supgrade* 127 124 128 = 1.5.2 - 12th Dec, 2025 = 125 129 *Compatibility support with codebase upgrade* -
woo-additional-fees-on-checkout-wordpress/trunk/woo-additional-fees-checkout.php
r3418398 r3424553 4 4 Plugin URI: https://www.wpsuperiors.com/additional-fees-for-woocommerce-checkout/ 5 5 Description: Formerly known as WooCommerce Additional Fees on Checkout can create an additional field on checkout page to apply an extra cost or fees. It supports block checkout. 6 Version: 1.5. 26 Version: 1.5.3 7 7 Author: WPSuperiors 8 8 Author URI: https://www.wpsuperiors.com/additional-fees-for-woocommerce-checkout/ 9 Text Domain: woo-additional-fees-on-checkout-wordpress 9 10 Requires at least: 6.3 10 11 Requires Plugins: woocommerce 12 License: GPLv2 or later 13 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 14 */ 15 12 16 if ( ! defined( 'ABSPATH' ) ) { 13 17 wp_die('Please Go Back'); … … 15 19 } 16 20 require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 17 add_action( 'admin_init', 'active_check' ); 18 function active_check() { 19 if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( 'woocommerce/woocommerce.php' ) ) { 20 add_action( 'admin_notices', 'active_failed_notice' ); 21 deactivate_plugins( plugin_basename( __FILE__ ) ); 22 if ( isset( $_GET['activate'] ) ) { 23 unset( $_GET['activate'] ); 21 add_action( 'admin_init', 'WAFOCW_active_check' ); 22 if( ! function_exists( 'WAFOCW_active_check' ) ){ 23 function WAFOCW_active_check() { 24 if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( 'woocommerce/woocommerce.php' ) ) { 25 add_action( 'admin_notices', 'WAFOCW_active_failed_notice' ); 26 deactivate_plugins( plugin_basename( __FILE__ ) ); 27 if ( isset( $_GET['activate'] ) ) { 28 unset( $_GET['activate'] ); 29 } 24 30 } 25 31 } 26 32 } 27 28 function active_failed_notice(){ 29 ?><div class="error"><p>Please Activate <b>WooCommerce</b> Plugin, Before You Proceed To Activate <b>WooCommerce Additional Fees On Checkout (Free)</b> Plugin.</p></div><?php 33 if( ! function_exists( 'WAFOCW_active_failed_notice' ) ){ 34 function WAFOCW_active_failed_notice(){ 35 ?><div class="error"><p>Please Activate <b>WooCommerce</b> Plugin, Before You Proceed To Activate <b>WooCommerce Additional Fees On Checkout (Free)</b> Plugin.</p></div><?php 36 } 30 37 } 31 32 38 33 39 define('WPS_EXT_CST', 'Woo Extra Cost/Fees'); … … 47 53 48 54 49 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'wps_wafc_action_links_free' ); 50 function wps_wafc_action_links_free($links) 51 { 52 $plugin_links = array( 53 '<a href="' . admin_url( 'admin.php?page=wps-ext-cst-option' ) . '">' . __( 'Settings') . '</a>', 54 '<a href="https://www.wpsuperiors.com/contact-us/">' . __( 'Get Support') . '</a>', 55 '<a href="https://www.wpsuperiors.com/additional-fees-for-woocommerce-checkout/">' . __( 'Get Premium') . '</a>' 56 ); 57 return array_merge( $plugin_links, $links ); 55 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'WAFOCW_action_links_free' ); 56 if( ! function_exists( 'WAFOCW_action_links_free' ) ){ 57 function WAFOCW_action_links_free($links) 58 { 59 $plugin_links = array( 60 '<a href="' . admin_url( 'admin.php?page=wps-ext-cst-option' ) . '">' . __( 'Settings','woo-additional-fees-on-checkout-wordpress') . '</a>', 61 '<a href="https://www.wpsuperiors.com/contact-us/">' . __( 'Get Support','woo-additional-fees-on-checkout-wordpress') . '</a>', 62 '<a href="https://www.wpsuperiors.com/additional-fees-for-woocommerce-checkout/">' . __( 'Get Premium','woo-additional-fees-on-checkout-wordpress') . '</a>' 63 ); 64 return array_merge( $plugin_links, $links ); 65 } 58 66 } 59 60 67 61 68 add_action( … … 73 80 ); 74 81 75 add_filter( 'wc_get_template' , 'wps_override_template' , 10 , 5 ); 76 77 function wps_override_template( $located, $template_name, $args, $template_path, $default_path ) { 78 if( file_exists( plugin_dir_path(__FILE__) . 'woocommerce/' . $template_name ) ) { 79 $located = plugin_dir_path(__FILE__) . 'woocommerce/' . $template_name; 82 add_filter( 'wc_get_template' , 'WAFOCW_override_template' , 10 , 5 ); 83 if( ! function_exists( 'WAFOCW_override_template' ) ){ 84 function WAFOCW_override_template( $located, $template_name, $args, $template_path, $default_path ) { 85 if( file_exists( plugin_dir_path(__FILE__) . 'woocommerce/' . $template_name ) ) { 86 $located = plugin_dir_path(__FILE__) . 'woocommerce/' . $template_name; 87 } 88 return $located; 80 89 } 81 return $located;82 90 } 83 91 -
woo-additional-fees-on-checkout-wordpress/trunk/woocommerce/checkout/review-order.php
r3232191 r3424553 21 21 <thead> 22 22 <tr> 23 <th class="product-name"><?php e sc_html_e( 'Product', 'woocommerce'); ?></th>24 <th class="product-total"><?php e sc_html_e( 'Subtotal', 'woocommerce'); ?></th>23 <th class="product-name"><?php echo esc_html(__( 'Product', 'woo-additional-fees-on-checkout-wordpress' )); ?></th> 24 <th class="product-total"><?php echo esc_html(__( 'Subtotal', 'woo-additional-fees-on-checkout-wordpress' )); ?></th> 25 25 </tr> 26 26 </thead> … … 54 54 55 55 <tr class="cart-subtotal"> 56 <th><?php e sc_html_e( 'Subtotal', 'woocommerce'); ?></th>56 <th><?php echo esc_html(__( 'Subtotal', 'woo-additional-fees-on-checkout-wordpress' )); ?></th> 57 57 <td><?php wc_cart_totals_subtotal_html(); ?></td> 58 58 </tr> … … 103 103 104 104 <tr class="order-total"> 105 <th><?php e sc_html_e( 'Total', 'woocommerce'); ?></th>105 <th><?php echo esc_html(__( 'Total', 'woo-additional-fees-on-checkout-wordpress' )); ?></th> 106 106 <td><?php wc_cart_totals_order_total_html(); ?></td> 107 107 </tr>
Note: See TracChangeset
for help on using the changeset viewer.