Plugin Directory

Changeset 3318250


Ignore:
Timestamp:
06/26/2025 12:36:50 PM (9 months ago)
Author:
cod24
Message:
  • Added fallback price for pishtaz and special shipping methods
  • Bugs fixes and improvements
Location:
cod24-shipping
Files:
26 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • cod24-shipping/trunk/cod24-shipping.php

    r3295424 r3318250  
    33Plugin Name: COD24 Shipping For Woocommerce
    44Description: This plugin is adding COD24 shipping methods to woocommerce.
    5 Version: 4.0.6
     5Version: 4.0.7
    66Author: COD24
    77Author URI: https://cod24.ir
     
    2727        public function __construct()
    2828        {
    29             define('COD24_PLUGIN_VERSION', '4.0.6');
     29            define('COD24_PLUGIN_VERSION', '4.0.7');
    3030            define('COD24_PLUGIN_DIR', plugin_dir_path(__FILE__));
    3131            define('COD24_PLUGIN_URL', plugin_dir_url(__FILE__));
  • cod24-shipping/trunk/inc/shipping/class-cod24-pishtaz.php

    r3254068 r3318250  
    55 * Package: COD24 Shipping
    66 * Author: COD24
    7  * Last Modified Time: 2024/09/16 22:53:23
     7 * Last Modified Time: 2025/06/26 15:53:39
    88 * License: GPL-2.0+
    99 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6161                            'description'   => __('Title to be display on site', 'cod24-shipping'),
    6262                            'default'       => __('Cod24 Pishtaz Shipping', 'cod24-shipping')
     63                        ),
     64                        'price' => array(
     65                            'title'       => __('Fallback Price', 'cod24-shipping'),
     66                            'type'        => 'price',
     67                            'description' => __('Price to use if API fails or returns 0', 'cod24-shipping'),
     68                            'default'     => '60000'
    6369                        )
    6470                    );
    6571                    $this->enabled           = $this->get_option( 'enabled' );
    6672                    $this->title             = $this->get_option( 'title' );
     73                    $this->fallback_price    = floatval( $this->get_option( 'price' ) );
    6774           
    6875                    add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
     
    174181                            'IR' => (!empty($response['totalPrice'])) ? $response['totalPrice'] : 0
    175182                        );
    176 
    177                         $cost = $countryZones['IR'];
     183                       
     184                        $cost = floatval($countryZones['IR']);
     185                        if (empty($cost) || $cost <= 0) {
     186                            $cost = $this->fallback_price;
     187                        }
    178188
    179189                        // convert current currency
  • cod24-shipping/trunk/inc/shipping/class-cod24-special.php

    r3254068 r3318250  
    55 * Package: COD24 Shipping
    66 * Author: COD24
    7  * Last Modified Time: 2024/09/16 22:52:57
     7 * Last Modified Time: 2025/06/26 15:54:00
    88 * License: GPL-2.0+
    99 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6161                            'description'   => __('Title to be display on site', 'cod24-shipping'),
    6262                            'default'       => __('Cod24 Special Shipping', 'cod24-shipping')
     63                        ),
     64                        'price' => array(
     65                            'title'       => __('Fallback Price', 'cod24-shipping'),
     66                            'type'        => 'price',
     67                            'description' => __('Price to use if API fails or returns 0', 'cod24-shipping'),
     68                            'default'     => '60000'
    6369                        )
    6470                    );
    6571                    $this->enabled           = $this->get_option( 'enabled' );
    6672                    $this->title             = $this->get_option( 'title' );
     73                    $this->fallback_price    = floatval( $this->get_option( 'price' ) );
    6774           
    6875                    add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
     
    179186                        );
    180187
    181                         $cost = $countryZones['IR'];
     188                        $cost = floatval($countryZones['IR']);
     189                        if (empty($cost) || $cost <= 0) {
     190                            $cost = $this->fallback_price;
     191                        }
    182192
    183193                        // convert current currency
    184                        
    185194                        if( $current_currency == 'IRR' ) {
    186195                            $shipping_cost = ceil($cost * 10);
  • cod24-shipping/trunk/readme.txt

    r3295424 r3318250  
    44Requires at least: 5.0
    55Tested up to: 6.8.1
    6 Stable tag: 4.0.6
     6Stable tag: 4.0.7
    77License: GPL-2.0+
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4343
    4444== Changelog ==
     45
     46= 4.0.7 =
     47* Added fallback price for pishtaz and special shipping methods
     48* Bugs fixes and improvements
    4549
    4650= 4.0.6 =
Note: See TracChangeset for help on using the changeset viewer.