Skip to content

Commit

Permalink
Updates to 2.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
WooCommerce committed Oct 16, 2024
1 parent add9569 commit f0ddf15
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 34 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
*** EU VAT Number Changelog ***

2024-10-14 - version 2.9.8
* Fix - Prevent unnecessary SOAP requests if the VAT number is incomplete.
* Fix - Ensure the VAT Number tab works as an endpoint URL.
* Dev - Bump WooCommerce "tested up to" version 9.4.
* Dev - Bump WooCommerce minimum supported version to 9.2.
* Dev - Bump WordPress minimum supported version to 6.5.

2024-09-09 - version 2.9.7
* Add - Disable reports & display a notice when HPOS is enabled & syncing is disabled.
* Fix - Ensure the proper IP country is shown in the EU VAT section of the order screen.
Expand Down
20 changes: 18 additions & 2 deletions includes/class-wc-eu-vat-my-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public function __construct() {

// New endpoint for vat-number WC >= 2.6.
add_action( 'init', array( $this, 'add_endpoints' ) );
add_filter( 'woocommerce_get_query_vars', array( $this, 'add_query_vars' ), 0 );
add_filter( 'woocommerce_get_query_vars', array( $this, 'add_query_vars' ) );
add_filter( 'woocommerce_endpoint_' . $this->endpoint . '_title', array( $this, 'update_endpoint_title' ) );

// Change My Account page title.
add_filter( 'the_title', array( $this, 'endpoint_title' ) );
Expand Down Expand Up @@ -151,11 +152,26 @@ public function add_endpoints() {
* @return array
*/
public function add_query_vars( $vars ) {
$vars[] = $this->endpoint;
$vars[ $this->endpoint ] = $this->endpoint;

return $vars;
}

/**
* Update endpoint title.
*
* @since 2.9.8
*
* @param string $title Endpoint title.
*
* @return string
*/
public function update_endpoint_title( $title ) {
$title = get_option( 'woocommerce_eu_vat_number_field_label', __( 'VAT number', 'woocommerce-eu-vat-number' ) );

return $title;
}

/**
* Set endpoint title.
*
Expand Down
4 changes: 4 additions & 0 deletions includes/class-wc-eu-vat-number.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ public static function vat_number_is_valid( $vat_number, $country, $postcode = '
$vat_prefix = 'XI';
}

if ( empty( $vat_number_formatted ) ) {
return new WP_Error( 'wc-eu-vat-api-error', __( 'The VAT number is incomplete.', 'woocommerce-eu-vat-number' ) );
}

// Return error if VAT Country Code doesn't match or exist.
if ( ! isset( self::$country_codes_patterns[ $vat_prefix ] ) || ( $vat_prefix . $vat_number_formatted !== $vat_number ) ) {
// translators: %1$s - VAT number field label, %2$s - VAT Number from user, %3$s - Billing country.
Expand Down
59 changes: 32 additions & 27 deletions languages/woocommerce-eu-vat-number.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This file is distributed under the GNU General Public License v3.0.
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce EU VAT Number 2.9.7\n"
"Project-Id-Version: WooCommerce EU VAT Number 2.9.8\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/woocommerce-eu-vat-number\n"
"POT-Creation-Date: 2024-09-09 14:33:52+00:00\n"
"POT-Creation-Date: 2024-10-14 17:15:25+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand All @@ -19,13 +19,14 @@ msgstr ""
#: includes/class-wc-eu-vat-admin.php:451
#: includes/class-wc-eu-vat-admin.php:469
#: includes/class-wc-eu-vat-admin.php:476
#: includes/class-wc-eu-vat-my-account.php:173
#: includes/class-wc-eu-vat-my-account.php:195
#: includes/class-wc-eu-vat-my-account.php:260
#: includes/class-wc-eu-vat-my-account.php:277
#: includes/class-wc-eu-vat-my-account.php:170
#: includes/class-wc-eu-vat-my-account.php:189
#: includes/class-wc-eu-vat-my-account.php:211
#: includes/class-wc-eu-vat-my-account.php:276
#: includes/class-wc-eu-vat-my-account.php:293
#: includes/class-wc-eu-vat-number.php:224
#: includes/class-wc-eu-vat-number.php:837
#: includes/class-wc-eu-vat-number.php:860
#: includes/class-wc-eu-vat-number.php:841
#: includes/class-wc-eu-vat-number.php:864
#: includes/class-wc-eu-vat-privacy.php:147
#: includes/class-wc-eu-vat-report-ec-sales-list.php:216
#: templates/my-account/my-vat-number.php:22
Expand Down Expand Up @@ -89,16 +90,16 @@ msgid "(self-declared)"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:411
#: includes/class-wc-eu-vat-my-account.php:254
#: includes/class-wc-eu-vat-number.php:839
#: includes/class-wc-eu-vat-number.php:861
#: includes/class-wc-eu-vat-my-account.php:270
#: includes/class-wc-eu-vat-number.php:843
#: includes/class-wc-eu-vat-number.php:865
msgid "billing"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:415
#: includes/class-wc-eu-vat-my-account.php:254
#: includes/class-wc-eu-vat-number.php:839
#: includes/class-wc-eu-vat-number.php:861
#: includes/class-wc-eu-vat-my-account.php:270
#: includes/class-wc-eu-vat-number.php:843
#: includes/class-wc-eu-vat-number.php:865
msgid "shipping"
msgstr ""

Expand Down Expand Up @@ -160,69 +161,73 @@ msgstr ""
msgid "VAT Data"
msgstr ""

#: includes/class-wc-eu-vat-my-account.php:247
#: includes/class-wc-eu-vat-my-account.php:263
msgid "VAT number cannot be empty."
msgstr ""

#: includes/class-wc-eu-vat-my-account.php:259
#: includes/class-wc-eu-vat-my-account.php:275
#. translators: %1$s VAT number field label, %2$s Country type.
msgid ""
"%1$s can not be validated because the %2$s country is missing. Please "
"update your %2$s address."
msgstr ""

#: includes/class-wc-eu-vat-my-account.php:276
#: includes/class-wc-eu-vat-my-account.php:292
#. translators: %1$s VAT number field label, %2$s VAT number, %3$s Country.
msgid "You have entered an invalid %1$s (%2$s) for your country (%3$s)."
msgstr ""

#: includes/class-wc-eu-vat-my-account.php:324
#: includes/class-wc-eu-vat-my-account.php:340
msgid "VAT number removed successfully!"
msgstr ""

#: includes/class-wc-eu-vat-my-account.php:326
#: includes/class-wc-eu-vat-my-account.php:342
msgid "VAT number saved successfully!"
msgstr ""

#: includes/class-wc-eu-vat-my-account.php:328
#: includes/class-wc-eu-vat-my-account.php:344
msgid "VAT number updated successfully!"
msgstr ""

#: includes/class-wc-eu-vat-number.php:337
msgid "VAT number is required."
msgstr ""

#: includes/class-wc-eu-vat-number.php:357
#: includes/class-wc-eu-vat-number.php:355
msgid "The VAT number is incomplete."
msgstr ""

#: includes/class-wc-eu-vat-number.php:361
#. translators: %1$s - VAT number field label, %2$s - VAT Number from user,
#. %3$s - Billing country.
msgid ""
"You have entered an invalid country code for %1$s (%2$s) for your country "
"(%3$s)."
msgstr ""

#: includes/class-wc-eu-vat-number.php:371
#: includes/class-wc-eu-vat-number.php:389
#: includes/class-wc-eu-vat-number.php:375
#: includes/class-wc-eu-vat-number.php:393
#: includes/vies/class-vies-client.php:92
msgid "Error communicating with the VAT validation server - please try again."
msgstr ""

#: includes/class-wc-eu-vat-number.php:693
#: includes/class-wc-eu-vat-number.php:697
#. translators: %s: VAT Number
msgid "VAT Number: %s"
msgstr ""

#: includes/class-wc-eu-vat-number.php:836
#: includes/class-wc-eu-vat-number.php:840
#. translators: 1: VAT number field label, 2: VAT Number, 3: Address type, 4:
#. Country
msgid "You have entered an invalid %1$s (%2$s) for your %3$s country (%4$s)."
msgstr ""

#: includes/class-wc-eu-vat-number.php:859
#: includes/class-wc-eu-vat-number.php:863
#. translators: 1: VAT number field label, 2: Address type, 3: Billing country
msgid "%1$s is a required field for your %2$s country (%3$s)."
msgstr ""

#: includes/class-wc-eu-vat-number.php:878
#: includes/class-wc-eu-vat-number.php:882
#. translators: 1: Ip Address.
msgid ""
"Your IP Address (%1$s) does not match your billing country (%2$s). European "
Expand Down
10 changes: 5 additions & 5 deletions woocommerce-eu-vat-number.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* Requires Plugins: woocommerce
* Plugin URI: https://woocommerce.com/products/eu-vat-number/
* Description: The EU VAT Number extension lets you collect and validate EU VAT numbers during checkout to identify B2B transactions verses B2C. IP Addresses can also be validated to ensure they match the billing address. EU businesses with a valid VAT number can have their VAT removed prior to payment.
* Version: 2.9.7
* Version: 2.9.8
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: woocommerce-eu-vat-number
* Domain Path: /languages
* Requires at least: 6.4
* Requires at least: 6.5
* Tested up to: 6.6
* WC requires at least: 9.0
* WC tested up to: 9.2
* WC requires at least: 9.2
* WC tested up to: 9.4
* Requires PHP: 7.4
* PHP tested up to: 8.3
*
Expand All @@ -26,7 +26,7 @@

// phpcs:disable WordPress.Files.FileName

define( 'WC_EU_VAT_VERSION', '2.9.7' ); // WRCS: DEFINED_VERSION.
define( 'WC_EU_VAT_VERSION', '2.9.8' ); // WRCS: DEFINED_VERSION.
define( 'WC_EU_VAT_FILE', __FILE__ );
define( 'WC_EU_ABSPATH', __DIR__ . '/' );
define( 'WC_EU_VAT_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
Expand Down

0 comments on commit f0ddf15

Please sign in to comment.