Plugin Directory

Changeset 3147257


Ignore:
Timestamp:
09/05/2024 07:38:17 PM (18 months ago)
Author:
webikon
Message:

Standardize weight unit to kg for parcelshop filtering

Location:
wc-dpd
Files:
98 added
6 edited

Legend:

Unmodified
Added
Removed
  • wc-dpd/trunk/includes/Shipping.php

    r3143150 r3147257  
    113113        }
    114114
    115         $parcelshop_shipping_method_settings = DpdParcelShopShippingMethod::getSettings();
     115        $parcelshop_shipping_method_settings = DpdParcelShopShippingMethod::getSettings();
    116116
    117117        // Get allowed countries codes in lowercase
     
    184184        }
    185185
     186        $wc_weight_unit = get_option('woocommerce_weight_unit');
     187        $cart_weight = (float) WC()->cart->get_cart_contents_weight();
     188
     189        // Convert weight to kg if necessary
     190        $min_weight_kg = $cart_weight;
     191        switch ($wc_weight_unit) {
     192            case 'g':
     193                $min_weight_kg = $cart_weight / 1000;
     194                break;
     195            case 'lbs':
     196                $min_weight_kg = $cart_weight * 0.45359237;
     197                break;
     198            case 'oz':
     199                $min_weight_kg = $cart_weight * 0.02834952;
     200                break;
     201                // 'kg' doesn't need conversion
     202        }
    186203
    187204        $disallow_shops = isset($parcelshop_shipping_method_settings[DpdParcelShopShippingMethod::DISALLOW_SHOPS_OPTION_KEY]) ? filter_var($parcelshop_shipping_method_settings[DpdParcelShopShippingMethod::DISALLOW_SHOPS_OPTION_KEY], FILTER_VALIDATE_BOOL) : false;
     
    204221            'allowed_countries' => (array) $allowed_countries,
    205222            'base_country_code' => (string) strtolower($base_country_code),
    206             'min_weight' => (float) WC()->cart->get_cart_contents_weight(),
     223            'min_weight' => (float) $min_weight_kg,
    207224            'is_eligible_for_alzabox' => $is_eligible_for_alzabox,
    208225            'is_eligible_for_slovenska_posta_box' => $is_eligible_for_slovenska_posta_box,
  • wc-dpd/trunk/languages/wc-dpd-sk_SK.po

    r3143150 r3147257  
    11msgid ""
    22msgstr ""
    3 "Project-Id-Version: DPD SK for WooCommerce - 7.0.0\n"
     3"Project-Id-Version: DPD SK for WooCommerce - 7.0.1\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2024-08-28 07:57+0200\n"
    6 "PO-Revision-Date: 2024-08-28 08:01+0200\n"
     5"POT-Creation-Date: 2024-09-05 21:34+0200\n"
     6"PO-Revision-Date: 2024-09-05 21:34+0200\n"
    77"Last-Translator: \n"
    88"Language-Team: Slovenčina\n"
  • wc-dpd/trunk/languages/wc-dpd.pot

    r3143150 r3147257  
    44msgid ""
    55msgstr ""
    6 "Project-Id-Version: DPD SK for WooCommerce - 7.0.0\n"
     6"Project-Id-Version: DPD SK for WooCommerce - 7.0.1\n"
    77"Report-Msgid-Bugs-To: \n"
    8 "POT-Creation-Date: 2024-08-28 07:57+0200\n"
     8"POT-Creation-Date: 2024-09-05 21:34+0200\n"
    99"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1010"Last-Translator: Webikon <[email protected]>\n"
  • wc-dpd/trunk/readme.txt

    r3143150 r3147257  
    66Tested up to: 6.6.1
    77Requires PHP: 7.4
    8 Stable tag: 7.0.0
     8Stable tag: 7.0.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6262
    6363== Changelog ==
     64
     65= 7.0.1 =
     66* Standardize weight unit to kg for parcelshop filtering
    6467
    6568= 7.0.0 =
  • wc-dpd/trunk/wc-dpd.php

    r3143150 r3147257  
    44 * Plugin Name: DPD SK for WooCommerce
    55 * Description: DPD SK plugin for WooCommerce which exports orders to the DPD through their API
    6  * Version: 7.0.0
     6 * Version: 7.0.1
    77 * Author: Webikon
    88 * Author URI: https://www.webikon.sk
Note: See TracChangeset for help on using the changeset viewer.