Plugin Directory

Changeset 3029601


Ignore:
Timestamp:
01/31/2024 04:01:23 PM (2 years ago)
Author:
antidot-dev
Message:

Release 3.0.5

Location:
bpost-shipping/trunk
Files:
5 edited

Legend:

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

    r3025080 r3029601  
    66 * Author: bpost
    77 * Author URI: https://www.bpost.be/
    8  * Version: 3.0.4
     8 * Version: 3.0.5
    99 * WC requires at least: 3.0
    1010 * WC tested up to: 8.9
     
    1515define( 'BPOST_PLUGIN_DIR', __DIR__ );
    1616define( 'BPOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    17 define( 'BPOST_PLUGIN_VERSION', '3.0.4' );
     17define( 'BPOST_PLUGIN_VERSION', '3.0.5' );
    1818
    1919/**
     
    167167add_action(
    168168    'woocommerce_after_shipping_rate',
    169     array( $bpost_shipping_hooks, 'woocommerce_after_shipping_rate_add_shipping_options' )
     169    array( $bpost_shipping_hooks, 'woocommerce_after_shipping_rate_add_shipping_options' ),
     170    10,
     171    2
    170172);
  • bpost-shipping/trunk/classes/class-wc-bpost-shipping-hooks.php

    r2991689 r3029601  
    428428    }
    429429
    430     /**
    431      * @param array $posted
    432      *
    433      * @return bool
    434      */
    435     private function is_bpost_shipping_from_post( array $posted ) {
    436         return
    437             array_key_exists( 'shipping_method', $posted )
    438             && is_array( $posted['shipping_method'] )
    439             && (
    440                 in_array( BPOST_PLUGIN_ID, $posted['shipping_method'], true )
    441                 || in_array( BPOST_PLUGIN_ID . '_error', $posted['shipping_method'], true )
    442             );
     430    private function must_the_button_is_displayed( string $chosen_shipping_method ): bool {
     431        switch ( $chosen_shipping_method ) {
     432            case BPOST_PLUGIN_ID:
     433            case BPOST_PLUGIN_ID . '_error':
     434                return true;
     435            default:
     436                return false;
     437        }
    443438    }
    444439
     
    465460    }
    466461
     462    /**
     463     * Does the cart need a shipping? -> Does teh cart
     464     * false if the cart contains only virtual items, else true
     465     */
    467466    private function need_shipping(): bool {
    468467        $shipping_packages       = WC()->cart->get_shipping_packages();
     
    477476        );
    478477
     478        // Condition to avoid bug if there is no item or more than 1 item
    479479        if ( $shipping_packages_count !== 1 ) {
    480480            Container::get_logger()->notice(
     
    674674    }
    675675
    676     public function woocommerce_after_shipping_rate_add_shipping_options( $method ) {
     676    public function woocommerce_after_shipping_rate_add_shipping_options( $method, $index ) {
    677677        /** @var WC_Shipping_Rate $method */
    678678        if ( $method->get_method_id() !== BPOST_PLUGIN_ID ) {
     
    684684        }
    685685
    686         if ( ! $this->is_bpost_shipping_from_post( $_POST ) ) {
     686        $chosen_shipping_methods = WC()->session->chosen_shipping_methods;
     687        $chosen_shipping_method  = isset( $chosen_shipping_methods[ $index ] ) ? $chosen_shipping_methods[ $index ] : '';
     688
     689        if ( ! $this->must_the_button_is_displayed( $chosen_shipping_method ) ) {
    687690            return;
    688691        }
  • bpost-shipping/trunk/composer.json

    r3025080 r3029601  
    33  "description": "WooCommerce plugin for bpost shipping",
    44  "type": "wordpress-plugin",
    5   "version": "3.0.4",
     5  "version": "3.0.5",
    66
    77  "require": {
  • bpost-shipping/trunk/languages/bpost_shipping.pot

    r3025080 r3029601  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: bpost shipping 3.0.4\n"
     5"Project-Id-Version: bpost shipping 3.0.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/package\n"
    7 "POT-Creation-Date: 2024-01-22 11:45:24+00:00\n"
     7"POT-Creation-Date: 2024-01-31 16:01:49+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=UTF-8\n"
     
    111111msgstr ""
    112112
    113 #: classes/class-wc-bpost-shipping-hooks.php:693
     113#: classes/class-wc-bpost-shipping-hooks.php:696
    114114msgid "You have to specify a delivery method"
    115115msgstr ""
    116116
    117 #: classes/class-wc-bpost-shipping-hooks.php:695
     117#: classes/class-wc-bpost-shipping-hooks.php:698
    118118msgid "Your bpost delivery method"
    119119msgstr ""
    120120
    121 #: classes/class-wc-bpost-shipping-hooks.php:700
     121#: classes/class-wc-bpost-shipping-hooks.php:703
    122122msgid "bpost_method_Regular"
    123123msgstr ""
    124124
    125 #: classes/class-wc-bpost-shipping-hooks.php:701
     125#: classes/class-wc-bpost-shipping-hooks.php:704
    126126msgid "bpost_method_Pugo"
    127127msgstr ""
    128128
    129 #: classes/class-wc-bpost-shipping-hooks.php:702
     129#: classes/class-wc-bpost-shipping-hooks.php:705
    130130msgid "bpost_method_Parcels depot"
    131131msgstr ""
    132132
    133 #: classes/class-wc-bpost-shipping-hooks.php:703
     133#: classes/class-wc-bpost-shipping-hooks.php:706
    134134msgid "bpost_method_bpack BUSINESS"
    135135msgstr ""
    136136
    137 #: classes/class-wc-bpost-shipping-hooks.php:704
     137#: classes/class-wc-bpost-shipping-hooks.php:707
    138138msgid "bpost_method_Pugo international"
    139139msgstr ""
    140140
    141 #: classes/class-wc-bpost-shipping-hooks.php:713
     141#: classes/class-wc-bpost-shipping-hooks.php:716
    142142msgid "Change the delivery method"
    143143msgstr ""
    144144
    145 #: classes/class-wc-bpost-shipping-hooks.php:739
     145#: classes/class-wc-bpost-shipping-hooks.php:742
    146146msgid "Please, specify a bpost delivery method!"
    147147msgstr ""
     
    197197msgstr ""
    198198
    199 #. #-#-#-#-#  bpost_shipping.pot (bpost shipping 3.0.4)  #-#-#-#-#
     199#. #-#-#-#-#  bpost_shipping.pot (bpost shipping 3.0.5)  #-#-#-#-#
    200200#. Author of the plugin/theme
    201201#: classes/class-wc-bpost-shipping-method.php:264
  • bpost-shipping/trunk/readme.txt

    r3025080 r3029601  
    88Tested up to: 6.4
    99Requires PHP: 7.4
    10 Stable tag: 3.0.4
     10Stable tag: 3.0.5
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1201205. Configure your bpost shipping settings under the Woocommerce shipping > bpost shipping tab
    121121== Changelog ==
     122
     123#### 3.0.5
     124
     125*Release date: 2024-01-31*
     126
     127* The popup button was not displayed in some cases
    122128
    123129#### 3.0.4
Note: See TracChangeset for help on using the changeset viewer.