Plugin Directory

Changeset 3362619


Ignore:
Timestamp:
09/16/2025 02:21:27 PM (5 months ago)
Author:
IQComputing
Message:

Update to version 1.0.5 from GitHub

Location:
live-rates-for-shipstation
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • live-rates-for-shipstation/tags/1.0.5/changelog.txt

    r3361859 r3362619  
    22
    33This is a brief text document keeping track of changes to the plugin. For a full history, see the Github Repository.
     4
     5= 1.0.5 =
     6
     7Relase Date: September 16, 2025
     8
     9* Overview
     10    * Patches an issue where shipping rates would come back much higher than expected
     11        * This was due to rates with multiple package types, but used the same service code.
     12        * Now, only the generic 'package' rate is returned.
     13    * Patches issue where disabled services would display during checkout.
     14    * Patches issue where service nickname would not apply.
     15        * This patch also ensures that during export/import to ShipStation it does not
     16            use the nickname, but service name for clarify.
     17    * Order item metadata added that breaks down:
     18        * Service (sevice_code)
     19        * Carrier (carrier_code)
     20        * Rate [Found shipping rate]
     21        * Adjustment [Any price adjustments made and whehter it's Global or Specific]
     22
     23* Code Updates
     24    * \IQLRSS\Core\Shipping_Method_Shipstation::labelify_meta_keys()
     25        * Translatable Order Item metadata keys.
     26    * \IQLRSS\Core\Shipping_Method_Shipstation::calculate_shipping()
     27        * Updates to store metadata
     28    * \IQLRSS\Core\Shipstation_Api::get_shipping_estimates()
     29        * Adds conditional to exclude any rates that are not for generic 'package' types.
    430
    531= 1.0.4 =
  • live-rates-for-shipstation/tags/1.0.5/core/settings-shipstation.php

    r3361859 r3362619  
    494494
    495495    /**
    496      * Update the WC_Order Shipping Method to match the ShipStation Carrier.
    497      * Ex. USPSPriorityMail
    498      *
    499      * @link https://help.shipstation.com/hc/en-us/articles/360025856192-Custom-Store-Development-Guide
     496     * Update the shipping method name to be the Service.
     497     * Usually not needed, but if a user updates a service name
     498     * to a nickname, this will make it easier to understand
     499     * once on ShipStation.
    500500     *
    501501     * @param WC_Order $order
     
    516516            // Not our shipping method.
    517517            if( $method->get_method_id() != $plugin_method_id ) continue;
    518 
    519             $service_name = $method->get_meta( 'service_name', true );
    520             $carrier_name = $method->get_meta( 'carrier_name', true );
    521 
    522             // Missing metadata.
    523             if( empty( $service_name ) || empty( $carrier_name ) ) continue;
    524 
     518           
     519            $service_name = (string)$method->get_meta( 'service', true );
    525520            $method->set_props( array(
    526                 'name' => preg_replace( '/([^a-zA-Z0-9])/', '', sprintf( '%s %s', $carrier_name, $service_name ) ),
     521                'name' => trim( explode( '(', $service_name )[0] ),
    527522            ) );
    528523            $method->apply_changes(); // Temporarily apply changes. This does not update the database.
  • live-rates-for-shipstation/tags/1.0.5/core/shipping-method-shipstation.php

    r3361859 r3362619  
    108108
    109109        add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
    110         add_filter( 'http_request_timeout', array( $this, 'increase_request_timeout' ) );
     110        add_filter( 'http_request_timeout',                     array( $this, 'increase_request_timeout' ) );
     111        add_filter( 'woocommerce_order_item_display_meta_key',  array( $this, 'labelify_meta_keys' ) );
    111112
    112113    }
     
    137138    public function increase_request_timeout( $timeout ) {
    138139        return ( $timeout < 20 ) ? 20 : $timeout;
     140    }
     141
     142
     143    /**
     144     * Edit Order Screen
     145     * Display Order Item Metadata, but labelify the $dispaly Key
     146     *
     147     * @param String $display
     148     *
     149     * @return String $display
     150     */
     151    public function labelify_meta_keys( $display ) {
     152
     153        $matches = array(
     154            'carrier'   => esc_html__( 'Carrier', 'live-rates-for-shipstation' ),
     155            'service'   => esc_html__( 'Service', 'live-rates-for-shipstation' ),
     156            'rate'      => esc_html__( 'Rate', 'live-rates-for-shipstation' ),
     157            'adjustment'=> esc_html__( 'Adjustment', 'live-rates-for-shipstation' ),
     158        );
     159
     160        return ( isset( $matches[ $display ] ) ) ? $matches[ $display ] : $display;
     161
    139162    }
    140163
     
    397420        }
    398421
    399         $saved_services = $this->get_option( 'services', array() );
    400         if( empty( $saved_services ) ) {
     422        $enabled_services = $this->get_enabled_services();
     423        if( empty( $enabled_services ) ) {
    401424            return;
    402425        }
    403426
    404         $saved_carriers = array_keys( $saved_services );
     427        $saved_carriers = array_keys( $enabled_services );
    405428        if( ! empty( $saved_carriers ) && ! empty( $this->carriers ) ) {
    406429            $saved_carriers = array_values( array_intersect( $saved_carriers, $this->carriers ) );
     
    476499            foreach( $available_rates as $shiprate ) {
    477500
    478                 if( ! isset( $saved_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ] ) ) {
     501                if( ! isset( $enabled_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ] ) ) {
    479502                    continue;
    480503                }
    481504
    482                 $service_arr = $saved_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ];
     505                $service_arr = $enabled_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ];
    483506                $cost = $shiprate['cost'];
     507                $metadata = array(
     508                    'carrier'   => sprintf( '%s (%s)', $shiprate['carrier_name'], $shiprate['carrier_code'] ),
     509                    'service'   => sprintf( '%s (%s)', $shiprate['name'], $shiprate['code'] ),
     510                    'rate'      => html_entity_decode( strip_tags( wc_price( $cost ) ) ),
     511                );
    484512
    485513                // Apply service upcharge
     
    494522
    495523                    if( ! empty( $adjustment_type ) && $adjustment > 0 ) {
    496                         $cost += ( 'flatrate' == $adjustment_type ) ? $adjustment : ( $cost * ( $adjustment / 100 ) );
     524
     525                        $adjustment_cost = ( 'flatrate' == $adjustment_type ) ? $adjustment : ( $cost * ( $adjustment / 100 ) );
     526                        $metadata['adjustment'] = sprintf( '%s (%s) - %s',
     527                            html_entity_decode( strip_tags( wc_price( $adjustment_cost ) ) ),
     528                            ucwords( $adjustment_type ),
     529                            esc_html__( 'Service Specific', 'live-rates-for-shipstation' ),
     530                        );
     531                        $cost += $adjustment_cost;
     532
    497533                    }
    498534
    499535                } else if( ! empty( $global_adjustment_type ) && $global_adjustment > 0 ) {
    500                     $cost += ( 'flatrate' == $global_adjustment_type ) ? floatval( $global_adjustment ) : ( $cost * ( floatval( $global_adjustment ) / 100 ) );
     536
     537                    $adjustment_cost = ( 'flatrate' == $global_adjustment_type ) ? floatval( $global_adjustment ) : ( $cost * ( floatval( $global_adjustment ) / 100 ) );
     538                    $metadata['adjustment'] = sprintf( '%s (%s) - %s',
     539                        html_entity_decode( strip_tags( wc_price( $adjustment_cost ) ) ),
     540                        ucwords( $global_adjustment_type ),
     541                        esc_html__( 'Global', 'live-rates-for-shipstation' ),
     542                    );
     543                    $cost += $adjustment_cost;
     544
    501545                }
    502546
     
    507551                $rate = array(
    508552                    'id'        => $shiprate['code'],
    509                     'label'     => sprintf( '%s (%s)', $shiprate['name'], $shiprate['carrier_name'] ),
     553                    'label'     => ( ! empty( $service_arr['nickname'] ) ) ? $service_arr['nickname'] : $shiprate['name'],
    510554                    'package'   => $packages,
    511                     'meta_data' => array(
    512                         'dimensions'    => $req['dimensions'],
    513                         'weight'        => $req['weight'],
    514                         'service_name'  => $shiprate['name'],
    515                         'carrier_code'  => $shiprate['carrier_code'],
    516                         'carrier_name'  => $shiprate['carrier_name'],
    517                     ),
     555                    'meta_data' => array_merge( $metadata, array(
     556                        'dimensions'=> $req['dimensions'],
     557                        'weight'    => $req['weight'],
     558                    ) ),
    518559                );
    519560
     
    875916
    876917    /**
     918     * Return an m-array of enabled services grouped by carrier key.
     919     *
     920     * @return Array
     921     */
     922    public function get_enabled_services() {
     923
     924        $enabled = array();
     925        $saved_services = $this->get_option( 'services', array() );
     926        if( empty( $saved_services ) ) return $enabled;
     927
     928        foreach( $saved_services as $c => $sa ) {
     929            foreach( $sa as $sk => $s ) {
     930                if( ! isset( $s['enabled'] ) || ! $s['enabled'] ) continue;
     931                $enabled[ $c ][ $sk ] = $s;
     932            }
     933        }
     934
     935        return $enabled;
     936
     937    }
     938
     939
     940    /**
    877941     * Log error in WooCommerce
    878942     * Passthru method - log what's given and give it back.
  • live-rates-for-shipstation/tags/1.0.5/core/shipstation-api.php

    r3361859 r3362619  
    247247            // Sometimes rates can be cost $0, which isn't right - skip them.
    248248            if( $rate['shipping_amount']['amount'] <= 0 ) continue;
     249            if( ! empty( $rate['package_type'] ) && 'package' != $rate['package_type'] ) continue;
    249250
    250251            $est = array(
  • live-rates-for-shipstation/tags/1.0.5/live-rates-for-shipstation.php

    r3361859 r3362619  
    44 * Plugin URI: https://iqcomputing.com/contact/
    55 * Description: ShipStation shipping method with live rates.
    6  * Version: 1.0.4
     6 * Version: 1.0.5
    77 * Requries at least: 5.9
    88 * Author: IQComputing
     
    2626     * @var String
    2727     */
    28     protected static $version = '1.0.4';
     28    protected static $version = '1.0.5';
    2929
    3030
  • live-rates-for-shipstation/tags/1.0.5/readme.txt

    r3361859 r3362619  
    44Requires at least: 5.9
    55Tested up to: 6.8
    6 Stable tag: 1.0.4
     6Stable tag: 1.0.5
    77License: GPLv3 or later
    88License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    4949== Changelog ==
    5050
     51= 1.0.5 (2025-09-16) =
     52* Patches shipping rate price disrepencies due to rates with multiple package types.
     53* Patches disabled shipping services displaying.
     54* Patches nicknames not applying properly.
     55* Adds/Displays order item metadata to track ship rate, rate adjustment, carrier, service, and codes.
     56
    5157= 1.0.4 (2025-09-15) =
    5258* Patches issues with shipping units not match store set units.
     
    5763= 1.0.3 (2025-08-05) =
    5864* Patches an issue with Shipping Method availability (Thanks to @sportswreathshop for reporting!)
    59 
    60 = 1.0.2 (2025-08-04) =
    61 * Refines API caching that clears on settings save (thanks again to @dpkonofa for test/reporting!).
  • live-rates-for-shipstation/trunk/changelog.txt

    r3361859 r3362619  
    22
    33This is a brief text document keeping track of changes to the plugin. For a full history, see the Github Repository.
     4
     5= 1.0.5 =
     6
     7Relase Date: September 16, 2025
     8
     9* Overview
     10    * Patches an issue where shipping rates would come back much higher than expected
     11        * This was due to rates with multiple package types, but used the same service code.
     12        * Now, only the generic 'package' rate is returned.
     13    * Patches issue where disabled services would display during checkout.
     14    * Patches issue where service nickname would not apply.
     15        * This patch also ensures that during export/import to ShipStation it does not
     16            use the nickname, but service name for clarify.
     17    * Order item metadata added that breaks down:
     18        * Service (sevice_code)
     19        * Carrier (carrier_code)
     20        * Rate [Found shipping rate]
     21        * Adjustment [Any price adjustments made and whehter it's Global or Specific]
     22
     23* Code Updates
     24    * \IQLRSS\Core\Shipping_Method_Shipstation::labelify_meta_keys()
     25        * Translatable Order Item metadata keys.
     26    * \IQLRSS\Core\Shipping_Method_Shipstation::calculate_shipping()
     27        * Updates to store metadata
     28    * \IQLRSS\Core\Shipstation_Api::get_shipping_estimates()
     29        * Adds conditional to exclude any rates that are not for generic 'package' types.
    430
    531= 1.0.4 =
  • live-rates-for-shipstation/trunk/core/settings-shipstation.php

    r3361859 r3362619  
    494494
    495495    /**
    496      * Update the WC_Order Shipping Method to match the ShipStation Carrier.
    497      * Ex. USPSPriorityMail
    498      *
    499      * @link https://help.shipstation.com/hc/en-us/articles/360025856192-Custom-Store-Development-Guide
     496     * Update the shipping method name to be the Service.
     497     * Usually not needed, but if a user updates a service name
     498     * to a nickname, this will make it easier to understand
     499     * once on ShipStation.
    500500     *
    501501     * @param WC_Order $order
     
    516516            // Not our shipping method.
    517517            if( $method->get_method_id() != $plugin_method_id ) continue;
    518 
    519             $service_name = $method->get_meta( 'service_name', true );
    520             $carrier_name = $method->get_meta( 'carrier_name', true );
    521 
    522             // Missing metadata.
    523             if( empty( $service_name ) || empty( $carrier_name ) ) continue;
    524 
     518           
     519            $service_name = (string)$method->get_meta( 'service', true );
    525520            $method->set_props( array(
    526                 'name' => preg_replace( '/([^a-zA-Z0-9])/', '', sprintf( '%s %s', $carrier_name, $service_name ) ),
     521                'name' => trim( explode( '(', $service_name )[0] ),
    527522            ) );
    528523            $method->apply_changes(); // Temporarily apply changes. This does not update the database.
  • live-rates-for-shipstation/trunk/core/shipping-method-shipstation.php

    r3361859 r3362619  
    108108
    109109        add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
    110         add_filter( 'http_request_timeout', array( $this, 'increase_request_timeout' ) );
     110        add_filter( 'http_request_timeout',                     array( $this, 'increase_request_timeout' ) );
     111        add_filter( 'woocommerce_order_item_display_meta_key',  array( $this, 'labelify_meta_keys' ) );
    111112
    112113    }
     
    137138    public function increase_request_timeout( $timeout ) {
    138139        return ( $timeout < 20 ) ? 20 : $timeout;
     140    }
     141
     142
     143    /**
     144     * Edit Order Screen
     145     * Display Order Item Metadata, but labelify the $dispaly Key
     146     *
     147     * @param String $display
     148     *
     149     * @return String $display
     150     */
     151    public function labelify_meta_keys( $display ) {
     152
     153        $matches = array(
     154            'carrier'   => esc_html__( 'Carrier', 'live-rates-for-shipstation' ),
     155            'service'   => esc_html__( 'Service', 'live-rates-for-shipstation' ),
     156            'rate'      => esc_html__( 'Rate', 'live-rates-for-shipstation' ),
     157            'adjustment'=> esc_html__( 'Adjustment', 'live-rates-for-shipstation' ),
     158        );
     159
     160        return ( isset( $matches[ $display ] ) ) ? $matches[ $display ] : $display;
     161
    139162    }
    140163
     
    397420        }
    398421
    399         $saved_services = $this->get_option( 'services', array() );
    400         if( empty( $saved_services ) ) {
     422        $enabled_services = $this->get_enabled_services();
     423        if( empty( $enabled_services ) ) {
    401424            return;
    402425        }
    403426
    404         $saved_carriers = array_keys( $saved_services );
     427        $saved_carriers = array_keys( $enabled_services );
    405428        if( ! empty( $saved_carriers ) && ! empty( $this->carriers ) ) {
    406429            $saved_carriers = array_values( array_intersect( $saved_carriers, $this->carriers ) );
     
    476499            foreach( $available_rates as $shiprate ) {
    477500
    478                 if( ! isset( $saved_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ] ) ) {
     501                if( ! isset( $enabled_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ] ) ) {
    479502                    continue;
    480503                }
    481504
    482                 $service_arr = $saved_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ];
     505                $service_arr = $enabled_services[ $shiprate['carrier_code'] ][ $shiprate['code'] ];
    483506                $cost = $shiprate['cost'];
     507                $metadata = array(
     508                    'carrier'   => sprintf( '%s (%s)', $shiprate['carrier_name'], $shiprate['carrier_code'] ),
     509                    'service'   => sprintf( '%s (%s)', $shiprate['name'], $shiprate['code'] ),
     510                    'rate'      => html_entity_decode( strip_tags( wc_price( $cost ) ) ),
     511                );
    484512
    485513                // Apply service upcharge
     
    494522
    495523                    if( ! empty( $adjustment_type ) && $adjustment > 0 ) {
    496                         $cost += ( 'flatrate' == $adjustment_type ) ? $adjustment : ( $cost * ( $adjustment / 100 ) );
     524
     525                        $adjustment_cost = ( 'flatrate' == $adjustment_type ) ? $adjustment : ( $cost * ( $adjustment / 100 ) );
     526                        $metadata['adjustment'] = sprintf( '%s (%s) - %s',
     527                            html_entity_decode( strip_tags( wc_price( $adjustment_cost ) ) ),
     528                            ucwords( $adjustment_type ),
     529                            esc_html__( 'Service Specific', 'live-rates-for-shipstation' ),
     530                        );
     531                        $cost += $adjustment_cost;
     532
    497533                    }
    498534
    499535                } else if( ! empty( $global_adjustment_type ) && $global_adjustment > 0 ) {
    500                     $cost += ( 'flatrate' == $global_adjustment_type ) ? floatval( $global_adjustment ) : ( $cost * ( floatval( $global_adjustment ) / 100 ) );
     536
     537                    $adjustment_cost = ( 'flatrate' == $global_adjustment_type ) ? floatval( $global_adjustment ) : ( $cost * ( floatval( $global_adjustment ) / 100 ) );
     538                    $metadata['adjustment'] = sprintf( '%s (%s) - %s',
     539                        html_entity_decode( strip_tags( wc_price( $adjustment_cost ) ) ),
     540                        ucwords( $global_adjustment_type ),
     541                        esc_html__( 'Global', 'live-rates-for-shipstation' ),
     542                    );
     543                    $cost += $adjustment_cost;
     544
    501545                }
    502546
     
    507551                $rate = array(
    508552                    'id'        => $shiprate['code'],
    509                     'label'     => sprintf( '%s (%s)', $shiprate['name'], $shiprate['carrier_name'] ),
     553                    'label'     => ( ! empty( $service_arr['nickname'] ) ) ? $service_arr['nickname'] : $shiprate['name'],
    510554                    'package'   => $packages,
    511                     'meta_data' => array(
    512                         'dimensions'    => $req['dimensions'],
    513                         'weight'        => $req['weight'],
    514                         'service_name'  => $shiprate['name'],
    515                         'carrier_code'  => $shiprate['carrier_code'],
    516                         'carrier_name'  => $shiprate['carrier_name'],
    517                     ),
     555                    'meta_data' => array_merge( $metadata, array(
     556                        'dimensions'=> $req['dimensions'],
     557                        'weight'    => $req['weight'],
     558                    ) ),
    518559                );
    519560
     
    875916
    876917    /**
     918     * Return an m-array of enabled services grouped by carrier key.
     919     *
     920     * @return Array
     921     */
     922    public function get_enabled_services() {
     923
     924        $enabled = array();
     925        $saved_services = $this->get_option( 'services', array() );
     926        if( empty( $saved_services ) ) return $enabled;
     927
     928        foreach( $saved_services as $c => $sa ) {
     929            foreach( $sa as $sk => $s ) {
     930                if( ! isset( $s['enabled'] ) || ! $s['enabled'] ) continue;
     931                $enabled[ $c ][ $sk ] = $s;
     932            }
     933        }
     934
     935        return $enabled;
     936
     937    }
     938
     939
     940    /**
    877941     * Log error in WooCommerce
    878942     * Passthru method - log what's given and give it back.
  • live-rates-for-shipstation/trunk/core/shipstation-api.php

    r3361859 r3362619  
    247247            // Sometimes rates can be cost $0, which isn't right - skip them.
    248248            if( $rate['shipping_amount']['amount'] <= 0 ) continue;
     249            if( ! empty( $rate['package_type'] ) && 'package' != $rate['package_type'] ) continue;
    249250
    250251            $est = array(
  • live-rates-for-shipstation/trunk/live-rates-for-shipstation.php

    r3361859 r3362619  
    44 * Plugin URI: https://iqcomputing.com/contact/
    55 * Description: ShipStation shipping method with live rates.
    6  * Version: 1.0.4
     6 * Version: 1.0.5
    77 * Requries at least: 5.9
    88 * Author: IQComputing
     
    2626     * @var String
    2727     */
    28     protected static $version = '1.0.4';
     28    protected static $version = '1.0.5';
    2929
    3030
  • live-rates-for-shipstation/trunk/readme.txt

    r3361859 r3362619  
    44Requires at least: 5.9
    55Tested up to: 6.8
    6 Stable tag: 1.0.4
     6Stable tag: 1.0.5
    77License: GPLv3 or later
    88License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    4949== Changelog ==
    5050
     51= 1.0.5 (2025-09-16) =
     52* Patches shipping rate price disrepencies due to rates with multiple package types.
     53* Patches disabled shipping services displaying.
     54* Patches nicknames not applying properly.
     55* Adds/Displays order item metadata to track ship rate, rate adjustment, carrier, service, and codes.
     56
    5157= 1.0.4 (2025-09-15) =
    5258* Patches issues with shipping units not match store set units.
     
    5763= 1.0.3 (2025-08-05) =
    5864* Patches an issue with Shipping Method availability (Thanks to @sportswreathshop for reporting!)
    59 
    60 = 1.0.2 (2025-08-04) =
    61 * Refines API caching that clears on settings save (thanks again to @dpkonofa for test/reporting!).
Note: See TracChangeset for help on using the changeset viewer.