Skip to content

Commit

Permalink
Updates to 2.9.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Woo committed Jan 22, 2025
1 parent 323a91f commit c40deb7
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 66 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*** EU VAT Number Changelog ***

2025-01-20 - version 2.9.13
* Fix - Resolved PHP notice caused by loading localization code too early on WordPress 6.7.0+.
* Dev - Bump WooCommerce "tested up to" version 9.6.
* Dev - Bump WooCommerce minimum supported version to 9.4.

2025-01-06 - version 2.9.12
* Fix - Replaced `{vat_id}` placeholder in WooCommerce Blocks checkout address cards.

Expand Down
9 changes: 8 additions & 1 deletion includes/class-wc-eu-vat-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WC_EU_VAT_Admin {
* Constructor.
*/
public static function init() {
self::$settings = require_once 'data/eu-vat-number-settings.php';
add_action( 'before_woocommerce_init', array( __CLASS__, 'init_form_fields' ) );
add_action( 'woocommerce_admin_billing_fields', array( __CLASS__, 'admin_billing_fields' ) );
add_action( 'woocommerce_admin_shipping_fields', array( __CLASS__, 'admin_shipping_fields' ) );
add_filter( 'woocommerce_order_get__shipping_vat_number', array( __CLASS__, 'get_vat_number_from_order' ), 10, 2 );
Expand Down Expand Up @@ -310,6 +310,13 @@ public static function save_admin_settings() {
}
}

/**
* Initialize settings array.
*/
public static function init_form_fields() {
self::$settings = require_once 'data/eu-vat-number-settings.php';
}

/**
* Add column.
*
Expand Down
12 changes: 11 additions & 1 deletion includes/class-wc-eu-vat-privacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ class WC_EU_VAT_Privacy extends WC_Abstract_Privacy {
* Constructor
*/
public function __construct() {
parent::__construct( __( 'EU VAT', 'woocommerce-eu-vat-number' ), 5, 9 );
parent::__construct( '', 5, 9 );

// Initialize data exporters and erasers.
add_action( 'init', array( $this, 'register_erasers_exporters' ) );
}

/**
* Initial registration of privacy erasers and exporters.
*/
public function register_erasers_exporters() {
$this->name = __( 'EU VAT', 'woocommerce-eu-vat-number' );

$this->add_exporter( 'woocommerce-eu-vat-number-order-data', __( 'WooCommerce EU VAT Order Data', 'woocommerce-eu-vat-number' ), array( $this, 'order_data_exporter' ) );
$this->add_exporter( 'woocommerce-eu-vat-number-customer-data', __( 'WooCommerce EU VAT Customer Data', 'woocommerce-eu-vat-number' ), array( $this, 'customer_data_exporter' ) );
Expand Down
17 changes: 11 additions & 6 deletions includes/class-wc-eu-vat-reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ public static function init() {
self::$order_util = false;
}

// The EU VAT reports are incompatible with stores running HPOS with syncing disabled.
if ( self::is_cot_enabled() && ! self::is_cot_sync_enabled() ) {
add_action( 'admin_notices', array( __CLASS__, 'display_hpos_incompatibility_notice' ) );
return;
}

add_action( 'admin_notices', array( __CLASS__, 'display_hpos_incompatibility_notice' ) );
add_action( 'woocommerce_admin_reports', array( __CLASS__, 'init_reports' ) );
}

Expand Down Expand Up @@ -73,6 +68,11 @@ public static function display_hpos_incompatibility_notice() {
return;
}

// The EU VAT reports are incompatible with stores running HPOS with syncing disabled.
if ( ! self::is_cot_enabled() || self::is_cot_sync_enabled() ) {
return;
}

if ( current_user_can( 'activate_plugins' ) ) {
/* translators: %1$s: Minimum version %2$s: Plugin page link start %3$s Link end */
printf(
Expand All @@ -96,6 +96,11 @@ public static function display_hpos_incompatibility_notice() {
* @return array
*/
public static function init_reports( $reports ) {
// The EU VAT reports are incompatible with stores running HPOS with syncing disabled.
if ( self::is_cot_enabled() && ! self::is_cot_sync_enabled() ) {
return $reports;
}

if ( isset( $reports['taxes'] ) ) {
$reports['taxes']['reports']['ec_sales_list'] = array(
'title' => __( 'EC Sales List', 'woocommerce-eu-vat-number' ),
Expand Down
68 changes: 34 additions & 34 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.12\n"
"Project-Id-Version: WooCommerce EU VAT Number 2.9.13\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/woocommerce-eu-vat-number\n"
"POT-Creation-Date: 2025-01-06 16:05:02+00:00\n"
"POT-Creation-Date: 2025-01-20 13:49:21+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand All @@ -16,9 +16,9 @@ msgstr ""

#: includes/class-wc-eu-vat-admin.php:114
#: includes/class-wc-eu-vat-admin.php:241
#: includes/class-wc-eu-vat-admin.php:457
#: includes/class-wc-eu-vat-admin.php:475
#: includes/class-wc-eu-vat-admin.php:464
#: includes/class-wc-eu-vat-admin.php:482
#: includes/class-wc-eu-vat-admin.php:489
#: 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
Expand All @@ -27,15 +27,15 @@ msgstr ""
#: includes/class-wc-eu-vat-number.php:224
#: includes/class-wc-eu-vat-number.php:852
#: includes/class-wc-eu-vat-number.php:875
#: includes/class-wc-eu-vat-privacy.php:147
#: includes/class-wc-eu-vat-privacy.php:157
#: includes/class-wc-eu-vat-report-ec-sales-list.php:216
#: templates/my-account/my-vat-number.php:22
msgid "VAT number"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:134
#: includes/class-wc-eu-vat-admin.php:325
#: includes/class-wc-eu-vat-privacy.php:20
#: includes/class-wc-eu-vat-admin.php:332
#: includes/class-wc-eu-vat-privacy.php:30
msgid "EU VAT"
msgstr ""

Expand Down Expand Up @@ -81,35 +81,35 @@ msgstr ""
msgid "Billing Country"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:357
#: includes/class-wc-eu-vat-admin.php:364
msgid "(validation failed)"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:369
#: includes/class-wc-eu-vat-admin.php:376
msgid "(self-declared)"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:417
#: includes/class-wc-eu-vat-admin.php:424
#: includes/class-wc-eu-vat-my-account.php:270
#: includes/class-wc-eu-vat-number.php:854
#: includes/class-wc-eu-vat-number.php:876
msgid "billing"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:421
#: includes/class-wc-eu-vat-admin.php:428
#: includes/class-wc-eu-vat-my-account.php:270
#: includes/class-wc-eu-vat-number.php:854
#: includes/class-wc-eu-vat-number.php:876
msgid "shipping"
msgstr ""

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

#: includes/class-wc-eu-vat-admin.php:562
#: includes/class-wc-eu-vat-admin.php:569
#. translators: %1$s Opening strong tag, %2$s Closing strong tag, %3$s Break
#. tag.
msgid ""
Expand All @@ -121,7 +121,7 @@ msgid ""
"from %1$sNorthern Ireland%2$s."
msgstr ""

#: includes/class-wc-eu-vat-admin.php:573
#: includes/class-wc-eu-vat-admin.php:580
#. translators: %1$s Opening strong tag, %2$s Closing strong tag.
msgid ""
"By using %1$sWooCommerce EU VAT Number%2$s plugin, you've agreed that the "
Expand All @@ -130,11 +130,11 @@ msgid ""
"tax specific questions."
msgstr ""

#: includes/class-wc-eu-vat-admin.php:578
#: includes/class-wc-eu-vat-admin.php:585
msgid "I understand"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:649
#: includes/class-wc-eu-vat-admin.php:656
#. translators: %1$s - <strong>, %2$s - </strong>, %3$s - Link to edit checkout
#. page, %4$s - closing tag
msgid ""
Expand Down Expand Up @@ -236,21 +236,21 @@ msgid ""
"your billing country using the checkbox below."
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:22
#: includes/class-wc-eu-vat-privacy.php:26
#: includes/class-wc-eu-vat-privacy.php:32
#: includes/class-wc-eu-vat-privacy.php:36
msgid "WooCommerce EU VAT Order Data"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:23
#: includes/class-wc-eu-vat-privacy.php:25
#: includes/class-wc-eu-vat-privacy.php:33
#: includes/class-wc-eu-vat-privacy.php:35
msgid "WooCommerce EU VAT Customer Data"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:29
#: includes/class-wc-eu-vat-privacy.php:39
msgid "WooCommerce EU VAT Subscriptions Data"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:74
#: includes/class-wc-eu-vat-privacy.php:84
#. translators: Privacy Docs URL.
msgid ""
"By using this extension, you may be storing personal data or sharing data "
Expand All @@ -259,31 +259,31 @@ msgid ""
"policy.</a>"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:99
#: includes/class-wc-eu-vat-privacy.php:109
msgid "Orders"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:103
#: includes/class-wc-eu-vat-privacy.php:113
msgid "EU VAT number"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:107
#: includes/class-wc-eu-vat-privacy.php:117
msgid "EU Billing VAT number"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:111
#: includes/class-wc-eu-vat-privacy.php:121
msgid "EU VAT country"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:143
#: includes/class-wc-eu-vat-privacy.php:153
msgid "Customer Data"
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:181
#: includes/class-wc-eu-vat-privacy.php:191
msgid "EU VAT User Data Erased."
msgstr ""

#: includes/class-wc-eu-vat-privacy.php:287
#: includes/class-wc-eu-vat-privacy.php:297
#. translators: Post type, Order ID.
msgid "Removed EU VAT data from %1$s %2$s."
msgstr ""
Expand Down Expand Up @@ -393,15 +393,15 @@ msgid ""
"synchronization%3$s if you wish to use EU VAT reports."
msgstr ""

#: includes/class-wc-eu-vat-reports.php:101
#: includes/class-wc-eu-vat-reports.php:106
msgid "EC Sales List"
msgstr ""

#: includes/class-wc-eu-vat-reports.php:107
#: includes/class-wc-eu-vat-reports.php:112
msgid "EU VAT by state"
msgstr ""

#: includes/class-wc-eu-vat-reports.php:113
#: includes/class-wc-eu-vat-reports.php:118
msgid "Non EU Sales"
msgstr ""

Expand Down Expand Up @@ -621,7 +621,7 @@ msgstr ""
msgid "Support"
msgstr ""

#: woocommerce-eu-vat-number.php:507
#: woocommerce-eu-vat-number.php:511
msgid "VAT Number"
msgstr ""

Expand Down Expand Up @@ -649,7 +649,7 @@ msgstr ""
msgid "https://woocommerce.com/"
msgstr ""

#: includes/class-wc-eu-vat-admin.php:726
#: includes/class-wc-eu-vat-admin.php:733
#: includes/data/eu-vat-number-settings.php:45
#: includes/data/eu-vat-number-settings.php:46
msgctxt "Default Field Label"
Expand Down
54 changes: 30 additions & 24 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.12
* Version: 2.9.13
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: woocommerce-eu-vat-number
* Domain Path: /languages
* Requires at least: 6.5
* Tested up to: 6.7
* WC requires at least: 9.3
* WC tested up to: 9.5
* WC requires at least: 9.4
* WC tested up to: 9.6
* 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.12' ); // WRCS: DEFINED_VERSION.
define( 'WC_EU_VAT_VERSION', '2.9.13' ); // 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 All @@ -41,7 +41,7 @@ class WC_EU_VAT_Number_Init {
*
* @var string
*/
const WC_MIN_VERSION = '9.3';
const WC_MIN_VERSION = '9.4';

/**
* Constructor.
Expand All @@ -50,7 +50,7 @@ public function __construct() {
add_action( 'plugins_loaded', array( $this, 'init' ), 9 );
add_action( 'woocommerce_blocks_loaded', array( $this, 'wc_eu_vat_number_block_init' ) );

add_action( 'plugins_loaded', array( $this, 'localization' ), 0 );
add_action( 'init', array( $this, 'localization' ) );

// Subscribe to automated translations.
add_filter( 'woocommerce_translations_updates_for_' . basename( __FILE__, '.php' ), '__return_true' );
Expand Down Expand Up @@ -498,24 +498,30 @@ function() {
}
);

register_block_type(
__DIR__ . '/block.json',
array(
'attributes' => array(
'title' => array(
'type' => 'string',
'default' => __( 'VAT Number', 'woocommerce-eu-vat-number' ),
),
'description' => array(
'type' => 'string',
'default' => '',
),
'showStepNumber' => array(
'type' => 'boolean',
'default' => true,
),
),
)
add_action(
'init',
function () {
// Register the block.
register_block_type(
__DIR__ . '/block.json',
array(
'attributes' => array(
'title' => array(
'type' => 'string',
'default' => __( 'VAT Number', 'woocommerce-eu-vat-number' ),
),
'description' => array(
'type' => 'string',
'default' => '',
),
'showStepNumber' => array(
'type' => 'boolean',
'default' => true,
),
),
)
);
}
);

// Extend store API with EU VAT Number related data.
Expand Down

0 comments on commit c40deb7

Please sign in to comment.