Skip to content

Commit

Permalink
v2.11.10
Browse files Browse the repository at this point in the history
  • Loading branch information
kousikmukherjee committed Jun 27, 2024
1 parent cdd52fa commit b6187b1
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 55 deletions.
6 changes: 3 additions & 3 deletions eu-vat-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: EU/UK VAT for WooCommerce
Plugin URI: https://wpfactory.com/item/eu-vat-for-woocommerce/
Description: Manage EU VAT in WooCommerce. Beautifully.
Version: 2.11.9
Version: 2.11.10
Author: WPFactory
Author URI: https://wpfactory.com/
Text Domain: eu-vat-for-woocommerce
Expand All @@ -22,7 +22,7 @@
* Main Alg_WC_EU_VAT Class
*
* @class Alg_WC_EU_VAT
* @version 2.11.8
* @version 2.11.10
* @since 1.0.0
*/
final class Alg_WC_EU_VAT {
Expand All @@ -33,7 +33,7 @@ final class Alg_WC_EU_VAT {
* @var string
* @since 1.0.0
*/
public $version = '2.11.9';
public $version = '2.11.10';
public $core = null;
public $settings = array();

Expand Down
39 changes: 22 additions & 17 deletions includes/class-alg-wc-eu-vat-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Alg_WC_EU_VAT_Core {
/**
* Constructor.
*
* @version 2.11.7
* @version 2.11.10
* @since 1.0.0
* @todo [dev] (maybe) "eu vat number" to "eu vat"
* @todo [feature] `add_eu_vat_verify_button` (`woocommerce_form_field_text`) (`return ( alg_wc_eu_vat_get_field_id() === $key ) ? $field . '<span style="font-size:smaller !important;">' . '[<a name="billing_eu_vat_number_verify" href="">' . __( 'Verify', 'eu-vat-for-woocommerce' ) . '</a>]' . '</span>' : $field;`)
Expand Down Expand Up @@ -147,20 +147,24 @@ function __construct() {

// checkout block

if ( version_compare( get_option( 'woocommerce_version', null ), '8.9.1', '>=' ) ) {

add_action('woocommerce_init', array( $this, 'register_additional_checkout_block_field' ), PHP_INT_MAX );

require_once ( __DIR__.'/../eu-vat-for-woocommerce-blocks-initialize.php') ;

add_action( 'woocommerce_store_api_checkout_update_order_from_request', array( $this, 'alg_eu_vat_update_block_order_meta_eu_vat' ), 10, 2 );
add_action( 'woocommerce_blocks_loaded', array( $this, 'alg_wc_eu_woocommerce_store_api_register_update_callback' ), 10 );
add_action( 'woocommerce_blocks_validate_location_contact_fields', array( $this, 'alg_wc_eu_woocommerce_validate_eu_vat_field_checkout_block' ), 10, 3 );
add_action( 'woocommerce_blocks_validate_location_address_fields', array( $this, 'alg_wc_eu_woocommerce_validate_eu_vat_field_checkout_block' ), 10, 3 );


add_filter( 'woocommerce_blocks_get_default_value_for_alg_eu_vat/billing_eu_vat_number', array( $this, 'alg_eu_vat_update_default_value_for_eu_vat_field' ), 99, 3 );



if ( 'yes' === get_option( 'alg_wc_eu_vat_enable_checkout_block_field', 'no' ) ) {
if ( version_compare( get_option( 'woocommerce_version', null ), '8.9.1', '>=' ) ) {

add_action('woocommerce_init', array( $this, 'register_additional_checkout_block_field' ), PHP_INT_MAX );

require_once ( __DIR__.'/../eu-vat-for-woocommerce-blocks-initialize.php') ;

add_action( 'woocommerce_store_api_checkout_update_order_from_request', array( $this, 'alg_eu_vat_update_block_order_meta_eu_vat' ), 10, 2 );
add_action( 'woocommerce_blocks_loaded', array( $this, 'alg_wc_eu_woocommerce_store_api_register_update_callback' ), 10 );
add_action( 'woocommerce_blocks_validate_location_contact_fields', array( $this, 'alg_wc_eu_woocommerce_validate_eu_vat_field_checkout_block' ), 10, 3 );
add_action( 'woocommerce_blocks_validate_location_address_fields', array( $this, 'alg_wc_eu_woocommerce_validate_eu_vat_field_checkout_block' ), 10, 3 );


add_filter( 'woocommerce_blocks_get_default_value_for_alg_eu_vat/billing_eu_vat_number', array( $this, 'alg_eu_vat_update_default_value_for_eu_vat_field' ), 99, 3 );

}
}

}
Expand Down Expand Up @@ -687,11 +691,11 @@ function required_in_countries( $value ) {
/**
* maybe_exclude_vat_free.
*
* @version 2.11.9
* @version 2.11.10
* @since 1.7.0
*/
function maybe_exclude_vat_free( $value ) {

$selected_country_at_checkout = '';
$preserve_base_country_check_passed = true;
if ( 'no' != ( $preserve_option_value = get_option( 'alg_wc_eu_vat_preserve_in_base_country', 'no' ) ) ) {
$selected_country = substr( alg_wc_eu_vat_session_get( 'alg_wc_eu_vat_to_check' ), 0, 2 );
Expand Down Expand Up @@ -728,6 +732,7 @@ function maybe_exclude_vat_free( $value ) {
$selected_country = 'GR';
}

$selected_country_at_checkout = WC()->checkout->get_value( 'billing_country' );

if ( 'yes' === $preserve_option_value ) {
$location = wc_get_base_location();
Expand Down
12 changes: 10 additions & 2 deletions includes/settings/class-alg-wc-eu-vat-settings-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* EU VAT for WooCommerce - Admin Section Settings
*
* @version 2.10.1
* @version 2.11.10
* @since 1.5.0
* @author WPFactory
*/
Expand Down Expand Up @@ -30,7 +30,7 @@ function __construct() {
/**
* get_settings.
*
* @version 2.10.1
* @version 2.11.10
* @since 1.5.0
* @todo [dev] (important) set "Session type" default value to "WC session (recommended)"
*/
Expand Down Expand Up @@ -159,6 +159,14 @@ function get_settings() {
'type' => 'checkbox',
),

array(
'title' => __( 'Checkout block field', 'eu-vat-for-woocommerce' ),
'desc' => __( 'Enable', 'eu-vat-for-woocommerce' ),
'id' => 'alg_wc_eu_vat_enable_checkout_block_field',
'default' => 'no',
'type' => 'checkbox',
),

array(
'type' => 'sectionend',
'id' => 'alg_wc_eu_vat_advanced_options',
Expand Down
69 changes: 37 additions & 32 deletions langs/eu-vat-for-woocommerce.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GNU General Public License v3.0.
msgid ""
msgstr ""
"Project-Id-Version: eu-vat-for-woocommerce 2.11.9\n"
"Project-Id-Version: eu-vat-for-woocommerce 2.11.10\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/eu-vat-for-woocommerce\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-06-27T10:42:48+02:00\n"
"POT-Creation-Date: 2024-06-27T12:27:15+02:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.9.0\n"
"X-Domain: eu-vat-for-woocommerce\n"
Expand Down Expand Up @@ -37,11 +37,11 @@ msgstr ""

#: eu-vat-for-woocommerce-blocks-initialize.php:55
#: includes/admin/class-alg-wc-eu-vat-admin.php:356
#: includes/class-alg-wc-eu-vat-core.php:1162
#: includes/class-alg-wc-eu-vat-core.php:1164
#: includes/class-alg-wc-eu-vat-core.php:1281
#: includes/class-alg-wc-eu-vat-core.php:1361
#: includes/class-alg-wc-eu-vat-core.php:1393
#: includes/class-alg-wc-eu-vat-core.php:1167
#: includes/class-alg-wc-eu-vat-core.php:1169
#: includes/class-alg-wc-eu-vat-core.php:1286
#: includes/class-alg-wc-eu-vat-core.php:1366
#: includes/class-alg-wc-eu-vat-core.php:1398
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:86
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:94
#: build/eu-vat-for-woocommerce-checkout-eu-vat-field-block.js:1
Expand Down Expand Up @@ -169,7 +169,7 @@ msgid "VAT is valid."
msgstr ""

#: includes/class-alg-wc-eu-vat-ajax.php:55
#: includes/class-alg-wc-eu-vat-core.php:1783
#: includes/class-alg-wc-eu-vat-core.php:1788
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:263
msgid "VAT is not valid."
msgstr ""
Expand Down Expand Up @@ -197,38 +197,38 @@ msgid "(optional)"
msgstr ""

#: includes/class-alg-wc-eu-vat-ajax.php:123
#: includes/class-alg-wc-eu-vat-core.php:1516
#: includes/class-alg-wc-eu-vat-core.php:1521
msgid "Error: Country by IP does not match (%s)"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:197
#: includes/class-alg-wc-eu-vat-core.php:361
#: includes/class-alg-wc-eu-vat-core.php:1679
#: includes/class-alg-wc-eu-vat-core.php:1748
#: includes/class-alg-wc-eu-vat-core.php:201
#: includes/class-alg-wc-eu-vat-core.php:365
#: includes/class-alg-wc-eu-vat-core.php:1684
#: includes/class-alg-wc-eu-vat-core.php:1753
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:70
msgid "<strong>EU VAT Number</strong> is not valid."
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:330
#: includes/class-alg-wc-eu-vat-core.php:1726
#: includes/class-alg-wc-eu-vat-core.php:334
#: includes/class-alg-wc-eu-vat-core.php:1731
msgid "Success (checkout): VAT ID valid. Matched with prevalidated VAT numbers."
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:356
#: includes/class-alg-wc-eu-vat-core.php:1756
#: includes/class-alg-wc-eu-vat-core.php:360
#: includes/class-alg-wc-eu-vat-core.php:1761
msgid "Error: VAT is not valid (checkout)"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:423
#: includes/class-alg-wc-eu-vat-core.php:427
msgid "VAT SHIFTED"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:973
#: includes/class-alg-wc-eu-vat-core.php:978
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:163
msgid "You didn't set your VAT ID. Are you sure you want to continue?"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:973
#: includes/class-alg-wc-eu-vat-core.php:978
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:171
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:180
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:202
Expand All @@ -246,21 +246,21 @@ msgstr ""
msgid "Yes"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:973
#: includes/class-alg-wc-eu-vat-core.php:978
msgid "No"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:1085
#: includes/class-alg-wc-eu-vat-core.php:1090
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:244
msgid "I don't have a VAT ID"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:1104
#: includes/class-alg-wc-eu-vat-core.php:1109
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:260
msgid "I have a valid VAT but not exempted"
msgstr ""

#: includes/class-alg-wc-eu-vat-core.php:1357
#: includes/class-alg-wc-eu-vat-core.php:1362
msgid "Customer Decide"
msgstr ""

Expand Down Expand Up @@ -374,6 +374,7 @@ msgstr ""
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:132
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:147
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:155
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:164
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:146
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:155
#: includes/settings/class-alg-wc-eu-vat-settings-general.php:251
Expand Down Expand Up @@ -447,35 +448,39 @@ msgstr ""
msgid "Enable if validation fails multiple times and you encounter the \"MS_MAX_CONCURRENT_REQ\" error after debugging."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:170
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:163
msgid "Checkout block field"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:178
msgid "Additional Info"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:174
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:182
msgid "Field ID used for EU VAT: %s."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:175
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:183
msgid "Tool for adding EU country standard VAT rates: %s."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:176
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:184
msgid "Tools > EU country VAT Rates"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:177
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:185
msgid "EU VAT report: %s."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:178
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:186
msgid "WooCommerce > Reports > Taxes > EU VAT"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:179
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:187
msgid "You can use shortcodes in field label, placeholder, description and all messages options, e.g.: %s."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:181
#: includes/settings/class-alg-wc-eu-vat-settings-admin.php:189
msgid "Plugin description on %s."
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: wpcodefactory, omardabbas, karzin, anbinder, algoritmika, kousikmu
Tags: EU VAT, UK VAT, tax, vat validation, VAT
Requires at least: 6.1
Tested up to: 6.5
Stable tag: 2.11.9
Stable tag: 2.11.10
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -290,6 +290,9 @@ Once activated, access the plugin's settings by navigating to “WooCommerce > S

== Changelog ==

= 2.11.10 - 27/06/2024 =
* Add - Checkout block field.

= 2.11.9 - 27/06/2024 =
* Add - Force validate on cart and checkout page load/reload.

Expand Down

0 comments on commit b6187b1

Please sign in to comment.