Plugin Directory

Changeset 3424553


Ignore:
Timestamp:
12/21/2025 10:21:19 AM (3 months ago)
Author:
amitwpdeveloper
Message:

1.5.3 update

Location:
woo-additional-fees-on-checkout-wordpress
Files:
20 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • woo-additional-fees-on-checkout-wordpress/trunk/classes/wps-ext-cst-admin-settings.php

    r3418398 r3424553  
    55        add_settings_section("wps-ext-cst-option-section", "Additional Fees Settings", null, "wps-ext-cst-options");
    66
    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;
    2140    }
    2241    public static function admin_settings(){
     
    4766                            <tbody>
    4867                                <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>
    5069                                    <td>
    5170                                        <select name="ext_cst_status" id="ext_cst_status">
     
    5675                                </tr>
    5776                                <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>
    7190                                    <td>
    7291                                        <select name="ext_cst_amount_type" id="ext_cst_amount_type" onchange="showHideTaxShipping(this,1)">
     
    7796                                </tr>
    7897                                <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>
    8099                                    <td>
    81100                                        <select name="ext_cst_inc_tax" id="ext_cst_inc_tax">
     
    86105                                </tr>
    87106                                <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>
    89108                                    <td>
    90109                                        <select name="ext_cst_inc_ship_costs" id="ext_cst_inc_ship_costs">
     
    95114                                </tr>
    96115                                <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>
    104123                                    <td>
    105124                                        <select data-id="1" class="ext_cst_cndtn_dropdown" name="ext_cst_apply_type" id="ext_cst_apply_type">
     
    113132                                <tr>
    114133                                    <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>
    116135                                        <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    117136                                    </th>
     
    125144                                </tr>
    126145                                <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>
    128147                                    <td>
    129148                                        <select data-id="1" class="ext_cst_cndtn_dropdown" name="ext_cst_apply_cndtn" id="ext_cst_apply_cndtn" onchange="show_hide_cndtn()">
     
    141160                                <tr>
    142161                                    <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>
    144163                                        <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    145164                                    </th>
     
    154173                                <tr>
    155174                                    <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>
    157176                                        <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    158177                                    </th>
     
    166185                                </tr>
    167186                                <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>
    171190                                    </td>
    172191                                </tr>
     
    176195                        <div id="wps_custom_fees_add_more" style="width: 50%; margin-left: auto; margin-right: auto;">
    177196                            <?php
    178 
     197                                $option = 0;
    179198                                if(is_array($extra_options) && !empty($extra_options)){
    180199                                    $count = 2;
     
    186205                                        //echo '<pre>'; print_r($value['selected_product_id_extra']); echo "</pre>";
    187206                                        ?>
    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); ?>">
    189208                                            <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>
    192211                                            </h3>
    193212                                            <table class="form-table">
    194213                                                <tbody>
    195214                                                    <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">
    199218                                                                <option value="enable" <?php if($value['status']=='enable'){ echo 'selected=selected';} ?>>Enable</option>
    200219                                                                <option value="disable" <?php if($value['status']=='disable'){ echo 'selected=selected';} ?>>Disable</option>
     
    203222                                                    </tr>
    204223                                                    <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); ?>)">
    220239                                                                <option value="fixed" <?php if($value['amount_type']=='fixed'){ echo 'selected=selected';} ?>>Fixed</option>
    221240                                                                <option value="percent" <?php if($value['amount_type']=='percent'){ echo 'selected=selected';} ?>>Percentage</option>
     
    223242                                                        </td>
    224243                                                    </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">
    229248                                                                <option value="yes" <?php if(isset($value['inc_tax']) && $value['inc_tax']=='yes'){echo 'selected';} ?>>Yes</option>
    230249                                                                <option value="no" <?php if(isset($value['inc_tax']) && $value['inc_tax']=='no'){echo 'selected';} ?>>No</option>
     
    232251                                                        </td>
    233252                                                    </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">
    238257                                                                <option value="yes" <?php if(isset($value['inc_ship_costs']) && $value['inc_ship_costs']=='yes'){echo 'selected';} ?>>Yes</option>
    239258                                                                <option value="no" <?php if(isset($value['inc_ship_costs']) && $value['inc_ship_costs']=='no'){echo 'selected';} ?>>No</option>
     
    242261                                                    </tr>
    243262                                                    <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); ?>">
    253272                                                                <option value="one_time">One Time Only</option>
    254273                                                                <option value="multiply">Multiplied By Product Quantity</option>
     
    260279                                                    <tr>
    261280                                                        <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>
    263282                                                            <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    264283                                                        </th>
    265284                                                        <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">
    267286                                                                <option value="enable">Enable</option>
    268287                                                                <option value="disable">Disable</option>
     
    272291                                                    </tr>
    273292                                                    <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); ?>)">
    277296                                                                <option value="all">All</option>
    278297                                                                <option>Cart Total Amount</option>
     
    288307                                                    <tr>
    289308                                                        <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>
    291310                                                            <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    292311                                                        </th>
    293312                                                        <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">
    295314                                                                <option value="no">No</option>
    296315                                                                <option value="yes">Yes</option>
     
    301320                                                    <tr>
    302321                                                        <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>
    304323                                                            <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    305324                                                        </th>
    306325                                                        <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); ?>">
    308327                                                                <option value="no">No</option>
    309328                                                                <option value="yes">Yes</option>
     
    316335                                        </div>
    317336                                        <script type="text/javascript">
    318                                             show_hide_cndtn_extra(<?php echo $option; ?>);
     337                                            show_hide_cndtn_extra(<?php echo esc_html($option); ?>);
    319338                                            function show_hide_cndtn_extra(s_id){
    320339                                                jQuery(".cndtn_mode_extra"+s_id).hide();
     
    323342                                                jQuery("#"+id+s_id).show();
    324343                                            }
    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();
    326345                                            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();   
    329348                                            }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();   
    332351                                            }
    333352
     
    340359
    341360                            ?>
    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); ?>" />
    343362                        </div>
    344363                        <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  
    1313    }
    1414    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(
    1616                'WPS_EXT_CST_Admin_Settings','admin_settings'));
    1717    }
     
    2727        ?>
    2828
    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']));?>">
    3030            <h3 style="border-bottom: 1px solid black;">
    3131                <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>
    3333            </h3>
    3434            <table class="form-table">
    3535                <tbody>
    3636                    <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>
    3838                        <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">
    4040                                <option value="enable">Enable</option>
    4141                                <option value="disable">Disable</option>
     
    4444                    </tr>
    4545                    <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>
    4747                        <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']);?>"/>
    4949                        </td>
    5050                    </tr>
    5151                    <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>
    5353                        <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']);?>"/>
    5555                        </td>
    5656                    </tr>
    5757                    <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>
    5959                        <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']);?>)">
    6161                                <option value="fixed">Fixed</option>
    6262                                <option value="percent">Percentage</option>
     
    6464                        </td>
    6565                    </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>
    6868                        <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">
    7070                                <option value="no">No</option>
    7171                                <option value="yes">Yes</option>
     
    7373                        </td>
    7474                    </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>
    7777                        <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">
    7979                                <option value="no">No</option>
    8080                                <option value="yes">Yes</option>
     
    8383                    </tr>
    8484                    <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>
    8686                        <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"/>
    8888                        </td>
    8989                    </tr>
    9090                    <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>
    9292                        <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']); ?>">
    9494                                <option value="one_time">One Time Only</option>
    9595                                <option value="multiply">Multiplied By Product Quantity</option>
     
    101101                    <tr>
    102102                        <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>
    104104                            <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    105105                        </th>
    106106                        <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">
    108108                                <option value="disable">Disable</option>
    109109                                <option value="enable">Enable</option>
     
    113113                    </tr>
    114114                    <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>
    116116                        <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']);?>)">
    118118                                <option value="all">All</option>
    119119                                <option value="cart_total_amount">Cart Total Amount</option>
     
    129129                    <tr>
    130130                        <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>
    132132                            <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    133133                        </th>
    134134                        <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">
    136136                                <option value="no">No</option>
    137137                                <option value="yes">Yes</option>
     
    142142                    <tr>
    143143                        <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>
    145145                            <p class="wps-feat-not">This feature will not work for WooCommerce Checkout Blocks.</p>
    146146                        </th>
    147147                        <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']); ?>">
    149149                                <option value="no">No</option>
    150150                                <option value="yes">Yes</option>
  • woo-additional-fees-on-checkout-wordpress/trunk/classes/wps-ext-cst-extra-fees-frontend.php

    r3418398 r3424553  
    5252                            <script type="text/javascript">
    5353                            jQuery( document ).ready(function( $ ) {
    54                                 $('#<?php echo $key; ?>').click(function(){
     54                                $('#<?php echo esc_html($key); ?>').click(function(){
    5555                                    jQuery('body').trigger('update_checkout');
    5656                                });
     
    8080                    $extra_final_cost = WPS_EXT_CST_Extra_Fees_Frontend::calculate_final_cost_extra($value);
    8181
    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(
    8484                            'type'          => 'checkbox',
    8585                            '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')
    8888                            ), $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)." />";
    9090                    echo "</div>";
    9191                }
     
    133133
    134134    }
    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   
    153136
    154137    public static function calculate_extra_costs( $cart ){
  • woo-additional-fees-on-checkout-wordpress/trunk/classes/wps-ext-cst-frontend.php

    r3418398 r3424553  
    5555                'label'         => $ext_cst_label,
    5656                'value'         => 158,
    57                 'placeholder'   => __('')
     57                'placeholder'   => __('None','woo-additional-fees-on-checkout-wordpress')
    5858                ), $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)." />";
    6060            echo '</div>';
    6161        }
     
    6565    public static function calculate_final_cost($amount, $type){
    6666       
     67        global $woocommerce;
    6768        $cost = $amount;
    6869
     
    112113            </script>
    113114            <style>
    114                 <?php echo $ext_cst_label_css; ?>
     115                <?php echo esc_html($ext_cst_label_css); ?>
    115116                .wps_hide_me{ display: none !important; }
    116117            </style>
  • woo-additional-fees-on-checkout-wordpress/trunk/readme.txt

    r3418398 r3424553  
    22Contributors: WPSuperiors, amitwpdeveloper
    33Tags: woocommerce extra cost, woocommerce additional cost, woocommerce checkout cost, woocommerce surcharge.
    4 Requires at least: 3.0.1
    5 Tested up to: 6.7
    6 Stable tag: 1.5.2
     4Requires at least: 6.3
     5Tested up to: 6.9
     6Stable tag: 1.5.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     9
    910
    1011Create required/non-required multiple fees for WooCommerce checkout, apply as fixed/percentage cost upon cart quantity/amount/product/category/type.
     
    122123
    123124== Changelog ==
     125= 1.5.3 - 21th Dec, 2025 =
     126*Compatibility supgrade*
     127
    124128= 1.5.2 - 12th Dec, 2025 =
    125129*Compatibility support with codebase upgrade*
  • woo-additional-fees-on-checkout-wordpress/trunk/woo-additional-fees-checkout.php

    r3418398 r3424553  
    44Plugin URI: https://www.wpsuperiors.com/additional-fees-for-woocommerce-checkout/
    55Description: 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.2
     6Version: 1.5.3
    77Author: WPSuperiors
    88Author URI: https://www.wpsuperiors.com/additional-fees-for-woocommerce-checkout/
     9Text Domain: woo-additional-fees-on-checkout-wordpress
    910Requires at least: 6.3
    1011Requires Plugins: woocommerce
     12License: GPLv2 or later
     13License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1114*/
     15
    1216if ( ! defined( 'ABSPATH' ) ) {
    1317    wp_die('Please Go Back');
     
    1519}
    1620require_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'] );
     21add_action( 'admin_init', 'WAFOCW_active_check' );
     22if( ! 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            }
    2430        }
    2531    }
    2632}
    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
     33if( ! 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    }
    3037}
    31 
    3238
    3339define('WPS_EXT_CST', 'Woo Extra Cost/Fees');
     
    4753
    4854
    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 );
     55add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'WAFOCW_action_links_free' );
     56if( ! 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    }
    5866}
    59 
    6067
    6168add_action(
     
    7380);
    7481
    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;
     82add_filter( 'wc_get_template' , 'WAFOCW_override_template' , 10 , 5 );
     83if( ! 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;
    8089    }
    81     return $located;
    8290}
    8391
  • woo-additional-fees-on-checkout-wordpress/trunk/woocommerce/checkout/review-order.php

    r3232191 r3424553  
    2121    <thead>
    2222        <tr>
    23             <th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
    24             <th class="product-total"><?php esc_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>
    2525        </tr>
    2626    </thead>
     
    5454
    5555        <tr class="cart-subtotal">
    56             <th><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
     56            <th><?php echo esc_html(__( 'Subtotal', 'woo-additional-fees-on-checkout-wordpress' )); ?></th>
    5757            <td><?php wc_cart_totals_subtotal_html(); ?></td>
    5858        </tr>
     
    103103
    104104        <tr class="order-total">
    105             <th><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
     105            <th><?php echo esc_html(__( 'Total', 'woo-additional-fees-on-checkout-wordpress' )); ?></th>
    106106            <td><?php wc_cart_totals_order_total_html(); ?></td>
    107107        </tr>
Note: See TracChangeset for help on using the changeset viewer.