Version Description
- Feature - WC_GZD_Product_Variable object containing get_variation_unit_price with min max option
- Fix - virtual vat calculation (vat exempt compatibility)
- Fix - email object $type check
Download this release
Release Info
Developer | vendidero |
Plugin | WooCommerce Germanized |
Version | 1.4.5 |
Comparing to | |
See all releases |
Code changes from version 1.4.4 to 1.4.5
- i18n/languages/woocommerce-germanized-de_DE.mo +0 -0
- i18n/languages/woocommerce-germanized-de_DE.po +13 -13
- includes/abstracts/abstract-wc-gzd-product.php +2 -1
- includes/class-wc-gzd-cart.php +13 -6
- includes/class-wc-gzd-emails.php +1 -1
- includes/class-wc-gzd-product-factory.php +19 -1
- includes/class-wc-gzd-product-variable.php +149 -0
- readme.txt +7 -2
- woocommerce-germanized.php +77 -16
i18n/languages/woocommerce-germanized-de_DE.mo
CHANGED
Binary file
|
i18n/languages/woocommerce-germanized-de_DE.po
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: WooCommerce Germanized v1.4.
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2014-09-29 12:26+0100\n"
|
6 |
-
"PO-Revision-Date: 2015-
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -1065,7 +1065,7 @@ msgstr "Zahlungsgebühr"
|
|
1065 |
|
1066 |
#: includes/abstracts/abstract-wc-gzd-product.php:130
|
1067 |
#: includes/wc-gzd-cart-functions.php:159
|
1068 |
-
#: woocommerce-germanized.php:
|
1069 |
#, php-format
|
1070 |
#@ woocommerce-germanized
|
1071 |
msgid "incl. %s%% VAT"
|
@@ -1244,7 +1244,7 @@ msgid "VAT free based on §19 UStG"
|
|
1244 |
msgstr "Kein Mehrwertsteuerausweis, da Kleinunternehmer nach §19 (1) UStG."
|
1245 |
|
1246 |
#: includes/gateways/invoice/class-wc-gzd-gateway-invoice.php:50
|
1247 |
-
#: woocommerce-germanized.php:
|
1248 |
#@ woocommerce
|
1249 |
msgid "Settings"
|
1250 |
msgstr "Einstellungen"
|
@@ -1618,7 +1618,7 @@ msgstr "Versandkosten-Hinweis auch für virtuelle Produkte aktivieren?"
|
|
1618 |
|
1619 |
#: includes/abstracts/abstract-wc-gzd-product.php:128
|
1620 |
#: includes/wc-gzd-cart-functions.php:159
|
1621 |
-
#: woocommerce-germanized.php:
|
1622 |
#@ woocommerce-germanized
|
1623 |
msgid "incl. VAT"
|
1624 |
msgstr "inkl. MwSt."
|
@@ -1920,12 +1920,12 @@ msgstr "Wenn Sie bei %s kein Benutzerkonto eröffnet haben, ignorieren Sie diese
|
|
1920 |
msgid "If you cannot follow the link above please copy this url and paste it to your browser bar: %s"
|
1921 |
msgstr "Falls Sie dem Link nicht folgen können, kopieren Sie bitte folgende URL in die Adresszeile Ihres Browsers: %s"
|
1922 |
|
1923 |
-
#: woocommerce-germanized.php:
|
1924 |
#@ woocommerce-germanized
|
1925 |
msgid "Thank you. You have successfully activated your account."
|
1926 |
msgstr "Vielen Dank. Ihr Benutzerkonto wurde erfolgreich aktiviert."
|
1927 |
|
1928 |
-
#: woocommerce-germanized.php:
|
1929 |
#@ woocommerce-germanized
|
1930 |
msgid "Sorry, but this activation code cannot be found."
|
1931 |
msgstr "Sorry, dieser Aktivierungscode ist uns leider nicht bekannt."
|
@@ -2593,14 +2593,14 @@ msgstr "Kontoinhaber"
|
|
2593 |
|
2594 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:114
|
2595 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:331
|
2596 |
-
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:
|
2597 |
#@ woocommerce-germanized
|
2598 |
msgid "IBAN"
|
2599 |
msgstr "IBAN"
|
2600 |
|
2601 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:120
|
2602 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:335
|
2603 |
-
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:
|
2604 |
#@ woocommerce-germanized
|
2605 |
msgid "BIC/SWIFT"
|
2606 |
msgstr "BIC/SWIFT"
|
@@ -2727,12 +2727,12 @@ msgstr "Der Ländercode des IBANs stimmt nicht mit dem Rechnungsland überein."
|
|
2727 |
msgid "Your BIC seems to be invalid."
|
2728 |
msgstr "Ihr BIC/SWIFT scheint nicht gültig zu sein."
|
2729 |
|
2730 |
-
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:
|
2731 |
#@ woocommerce
|
2732 |
msgid "is invalid"
|
2733 |
msgstr ""
|
2734 |
|
2735 |
-
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:
|
2736 |
#@ woocommerce-germanized
|
2737 |
msgid "Processing direct debit"
|
2738 |
msgstr "Lastschriftverfahren vorbereiten"
|
@@ -3015,6 +3015,6 @@ msgstr "Diese Option löscht alle Einstellungen, die dazu führen, dass die Tour
|
|
3015 |
#. translators: plugin header field 'Version'
|
3016 |
#: woocommerce-germanized.php:0
|
3017 |
#@ woocommerce-germanized
|
3018 |
-
msgid "1.4.
|
3019 |
-
msgstr "1.4.
|
3020 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: WooCommerce Germanized v1.4.4\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2014-09-29 12:26+0100\n"
|
6 |
+
"PO-Revision-Date: 2015-10-16 08:02:48+0000\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
1065 |
|
1066 |
#: includes/abstracts/abstract-wc-gzd-product.php:130
|
1067 |
#: includes/wc-gzd-cart-functions.php:159
|
1068 |
+
#: woocommerce-germanized.php:944
|
1069 |
#, php-format
|
1070 |
#@ woocommerce-germanized
|
1071 |
msgid "incl. %s%% VAT"
|
1244 |
msgstr "Kein Mehrwertsteuerausweis, da Kleinunternehmer nach §19 (1) UStG."
|
1245 |
|
1246 |
#: includes/gateways/invoice/class-wc-gzd-gateway-invoice.php:50
|
1247 |
+
#: woocommerce-germanized.php:594
|
1248 |
#@ woocommerce
|
1249 |
msgid "Settings"
|
1250 |
msgstr "Einstellungen"
|
1618 |
|
1619 |
#: includes/abstracts/abstract-wc-gzd-product.php:128
|
1620 |
#: includes/wc-gzd-cart-functions.php:159
|
1621 |
+
#: woocommerce-germanized.php:944
|
1622 |
#@ woocommerce-germanized
|
1623 |
msgid "incl. VAT"
|
1624 |
msgstr "inkl. MwSt."
|
1920 |
msgid "If you cannot follow the link above please copy this url and paste it to your browser bar: %s"
|
1921 |
msgstr "Falls Sie dem Link nicht folgen können, kopieren Sie bitte folgende URL in die Adresszeile Ihres Browsers: %s"
|
1922 |
|
1923 |
+
#: woocommerce-germanized.php:789
|
1924 |
#@ woocommerce-germanized
|
1925 |
msgid "Thank you. You have successfully activated your account."
|
1926 |
msgstr "Vielen Dank. Ihr Benutzerkonto wurde erfolgreich aktiviert."
|
1927 |
|
1928 |
+
#: woocommerce-germanized.php:793
|
1929 |
#@ woocommerce-germanized
|
1930 |
msgid "Sorry, but this activation code cannot be found."
|
1931 |
msgstr "Sorry, dieser Aktivierungscode ist uns leider nicht bekannt."
|
2593 |
|
2594 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:114
|
2595 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:331
|
2596 |
+
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:425
|
2597 |
#@ woocommerce-germanized
|
2598 |
msgid "IBAN"
|
2599 |
msgstr "IBAN"
|
2600 |
|
2601 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:120
|
2602 |
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:335
|
2603 |
+
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:426
|
2604 |
#@ woocommerce-germanized
|
2605 |
msgid "BIC/SWIFT"
|
2606 |
msgstr "BIC/SWIFT"
|
2727 |
msgid "Your BIC seems to be invalid."
|
2728 |
msgstr "Ihr BIC/SWIFT scheint nicht gültig zu sein."
|
2729 |
|
2730 |
+
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:427
|
2731 |
#@ woocommerce
|
2732 |
msgid "is invalid"
|
2733 |
msgstr ""
|
2734 |
|
2735 |
+
#: includes/gateways/direct-debit/class-wc-gzd-gateway-direct-debit.php:465
|
2736 |
#@ woocommerce-germanized
|
2737 |
msgid "Processing direct debit"
|
2738 |
msgstr "Lastschriftverfahren vorbereiten"
|
3015 |
#. translators: plugin header field 'Version'
|
3016 |
#: woocommerce-germanized.php:0
|
3017 |
#@ woocommerce-germanized
|
3018 |
+
msgid "1.4.4"
|
3019 |
+
msgstr "1.4.4"
|
3020 |
|
includes/abstracts/abstract-wc-gzd-product.php
CHANGED
@@ -107,7 +107,7 @@ class WC_GZD_Product {
|
|
107 |
* @return boolean
|
108 |
*/
|
109 |
public function is_virtual_vat_exception() {
|
110 |
-
return apply_filters( 'woocommerce_gzd_product_virtual_vat_exception', ( ( get_option( 'woocommerce_gzd_enable_virtual_vat' )
|
111 |
}
|
112 |
|
113 |
/**
|
@@ -342,5 +342,6 @@ class WC_GZD_Product {
|
|
342 |
);
|
343 |
return str_replace( $find, $replace, get_option( 'woocommerce_gzd_shipping_costs_text' ) );
|
344 |
}
|
|
|
345 |
}
|
346 |
?>
|
107 |
* @return boolean
|
108 |
*/
|
109 |
public function is_virtual_vat_exception() {
|
110 |
+
return apply_filters( 'woocommerce_gzd_product_virtual_vat_exception', ( ( get_option( 'woocommerce_gzd_enable_virtual_vat' ) === 'yes' ) && ( $this->is_downloadable() || $this->is_virtual() ) ? true : false ), $this );
|
111 |
}
|
112 |
|
113 |
/**
|
342 |
);
|
343 |
return str_replace( $find, $replace, get_option( 'woocommerce_gzd_shipping_costs_text' ) );
|
344 |
}
|
345 |
+
|
346 |
}
|
347 |
?>
|
includes/class-wc-gzd-cart.php
CHANGED
@@ -127,8 +127,9 @@ class WC_GZD_Cart extends WC_Cart {
|
|
127 |
$taxes = WC_Tax::calc_tax( $line_price, $base_tax_rates, true, true );
|
128 |
|
129 |
// Digital VAT exception
|
130 |
-
if ( $this->is_virtual_taxable() && $_product->gzd_product->is_virtual_vat_exception() )
|
131 |
$taxes = WC_Tax::calc_tax( $line_price, $item_tax_rates, true, true );
|
|
|
132 |
|
133 |
// Now we have a new item price (excluding TAX)
|
134 |
$line_subtotal = $line_price - array_sum( $taxes );
|
@@ -360,15 +361,21 @@ class WC_GZD_Cart extends WC_Cart {
|
|
360 |
* @return boolean
|
361 |
*/
|
362 |
public function is_virtual_taxable() {
|
363 |
-
|
364 |
-
|
365 |
-
|
|
|
|
|
366 |
$taxable_address = WC()->customer->get_taxable_address();
|
367 |
$base_country = WC()->countries->get_base_country();
|
|
|
368 |
if ( isset( $taxable_address[0] ) && $taxable_address[0] != $base_country && in_array( $taxable_address[0], WC()->countries->get_european_union_countries() ) )
|
369 |
-
|
|
|
370 |
}
|
371 |
-
|
|
|
|
|
372 |
}
|
373 |
|
374 |
}
|
127 |
$taxes = WC_Tax::calc_tax( $line_price, $base_tax_rates, true, true );
|
128 |
|
129 |
// Digital VAT exception
|
130 |
+
if ( $this->is_virtual_taxable() && $_product->gzd_product->is_virtual_vat_exception() ) {
|
131 |
$taxes = WC_Tax::calc_tax( $line_price, $item_tax_rates, true, true );
|
132 |
+
}
|
133 |
|
134 |
// Now we have a new item price (excluding TAX)
|
135 |
$line_subtotal = $line_price - array_sum( $taxes );
|
361 |
* @return boolean
|
362 |
*/
|
363 |
public function is_virtual_taxable() {
|
364 |
+
|
365 |
+
$is_taxable = false;
|
366 |
+
|
367 |
+
if ( get_option( 'woocommerce_gzd_enable_virtual_vat' ) === 'yes' && ( ! empty( WC()->customer ) ) ) {
|
368 |
+
|
369 |
$taxable_address = WC()->customer->get_taxable_address();
|
370 |
$base_country = WC()->countries->get_base_country();
|
371 |
+
|
372 |
if ( isset( $taxable_address[0] ) && $taxable_address[0] != $base_country && in_array( $taxable_address[0], WC()->countries->get_european_union_countries() ) )
|
373 |
+
$is_taxable = true;
|
374 |
+
|
375 |
}
|
376 |
+
|
377 |
+
return apply_filters( 'woocommerce_gzd_is_virtual_taxable', $is_taxable, $this );
|
378 |
+
|
379 |
}
|
380 |
|
381 |
}
|
includes/class-wc-gzd-emails.php
CHANGED
@@ -72,7 +72,7 @@ class WC_GZD_Emails {
|
|
72 |
|
73 |
$type = $this->get_current_email_object();
|
74 |
|
75 |
-
if ( $type->id == 'customer_processing_order' ) {
|
76 |
|
77 |
// Check if order contains digital products
|
78 |
$items = $order->get_items();
|
72 |
|
73 |
$type = $this->get_current_email_object();
|
74 |
|
75 |
+
if ( $type && $type->id == 'customer_processing_order' ) {
|
76 |
|
77 |
// Check if order contains digital products
|
78 |
$items = $order->get_items();
|
includes/class-wc-gzd-product-factory.php
CHANGED
@@ -22,7 +22,7 @@ class WC_GZD_Product_Factory extends WC_Product_Factory {
|
|
22 |
public function get_product( $the_product = false, $args = array() ) {
|
23 |
$product = $this->get_product_standalone( $the_product, $args );
|
24 |
if ( is_object( $product ) )
|
25 |
-
$product->gzd_product =
|
26 |
return $product;
|
27 |
}
|
28 |
|
@@ -37,4 +37,22 @@ class WC_GZD_Product_Factory extends WC_Product_Factory {
|
|
37 |
return parent::get_product( $the_product, $args );
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
22 |
public function get_product( $the_product = false, $args = array() ) {
|
23 |
$product = $this->get_product_standalone( $the_product, $args );
|
24 |
if ( is_object( $product ) )
|
25 |
+
$product->gzd_product = $this->get_gzd_product( $product );
|
26 |
return $product;
|
27 |
}
|
28 |
|
37 |
return parent::get_product( $the_product, $args );
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* Returns and locates the WC_GZD_Product Object based on product type.
|
42 |
+
*
|
43 |
+
* @param object $product WC_Product
|
44 |
+
* @return object WC_GZD_Product
|
45 |
+
*/
|
46 |
+
public function get_gzd_product( $product ) {
|
47 |
+
|
48 |
+
$type = $product->product_type;
|
49 |
+
$classname = 'WC_GZD_Product_' . ucfirst( $type );
|
50 |
+
|
51 |
+
if ( class_exists( $classname ) )
|
52 |
+
return new $classname( $product );
|
53 |
+
|
54 |
+
return new WC_GZD_Product( $product );
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
}
|
includes/class-wc-gzd-product-variable.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) )
|
4 |
+
exit; // Exit if accessed directly
|
5 |
+
|
6 |
+
/**
|
7 |
+
* WooCommerce Germanized Product Variable
|
8 |
+
*
|
9 |
+
* The WC_GZD_Product_Variable Class is used to offer additional functionality for every variable product.
|
10 |
+
*
|
11 |
+
* @class WC_GZD_Product
|
12 |
+
* @version 1.0.0
|
13 |
+
* @author Vendidero
|
14 |
+
*/
|
15 |
+
class WC_GZD_Product_Variable extends WC_GZD_Product {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Get the min or max variation unit regular price.
|
19 |
+
* @param string $min_or_max - min or max
|
20 |
+
* @param boolean $display Whether the value is going to be displayed
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function get_variation_unit_regular_price( $min_or_max = 'min', $display = false ) {
|
24 |
+
$prices = $this->get_variation_unit_prices( $display );
|
25 |
+
$price = 'min' === $min_or_max ? current( $prices['regular_price'] ) : end( $prices['regular_price'] );
|
26 |
+
return apply_filters( 'woocommerce_gzd_get_variation_unit_regular_price', $price, $this, $min_or_max, $display );
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get the min or max variation unit sale price.
|
31 |
+
* @param string $min_or_max - min or max
|
32 |
+
* @param boolean $display Whether the value is going to be displayed
|
33 |
+
* @return string
|
34 |
+
*/
|
35 |
+
public function get_variation_unit_sale_price( $min_or_max = 'min', $display = false ) {
|
36 |
+
$prices = $this->get_variation_unit_prices( $display );
|
37 |
+
$price = 'min' === $min_or_max ? current( $prices['sale_price'] ) : end( $prices['sale_price'] );
|
38 |
+
return apply_filters( 'woocommerce_gzd_get_variation_unit_sale_price', $price, $this, $min_or_max, $display );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Get the min or max variation (active) unit price.
|
43 |
+
* @param string $min_or_max - min or max
|
44 |
+
* @param boolean $display Whether the value is going to be displayed
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
public function get_variation_unit_price( $min_or_max = 'min', $display = false ) {
|
48 |
+
$prices = $this->get_variation_unit_prices( $display );
|
49 |
+
$price = 'min' === $min_or_max ? current( $prices['price'] ) : end( $prices['price'] );
|
50 |
+
return apply_filters( 'woocommerce_gzd_get_variation_unit_price', $price, $this, $min_or_max, $display );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Get an array of all sale and regular unit prices from all variations. This is used for example when displaying the price range at variable product level or seeing if the variable product is on sale.
|
55 |
+
*
|
56 |
+
* Can be filtered by plugins which modify costs, but otherwise will include the raw meta costs unlike get_price() which runs costs through the woocommerce_get_price filter.
|
57 |
+
* This is to ensure modified prices are not cached, unless intended.
|
58 |
+
*
|
59 |
+
* @param bool $display Are prices for display? If so, taxes will be calculated.
|
60 |
+
* @return array() Array of RAW prices, regular prices, and sale prices with keys set to variation ID.
|
61 |
+
*/
|
62 |
+
public function get_variation_unit_prices( $display = false ) {
|
63 |
+
|
64 |
+
if ( ! $this->is_type( 'variable' ) )
|
65 |
+
return false;
|
66 |
+
|
67 |
+
global $wp_filter;
|
68 |
+
|
69 |
+
if ( ! empty( $this->unit_prices_array ) ) {
|
70 |
+
return $this->unit_prices_array;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Create unique cache key based on the tax location (affects displayed/cached prices), product version and active price filters.
|
75 |
+
* Max transient length is 45, -10 for get_transient_version.
|
76 |
+
* @var string
|
77 |
+
*/
|
78 |
+
$hash = array( $this->id, $display, $display ? WC_Tax::get_rates() : array() );
|
79 |
+
|
80 |
+
foreach ( $wp_filter as $key => $val ) {
|
81 |
+
if ( in_array( $key, array( 'woocommerce_gzd_variation_unit_prices_price', 'woocommerce_gzd_variation_unit_prices_regular_price', 'woocommerce_gzd_variation_unit_prices_sale_price' ) ) ) {
|
82 |
+
$hash[ $key ] = $val;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* DEVELOPERS should filter this hash if offering conditonal pricing to keep it unique.
|
88 |
+
*/
|
89 |
+
$hash = apply_filters( 'woocommerce_gzd_get_variation_unit_prices_hash', $hash, $this, $display );
|
90 |
+
$cache_key = 'wc_gzd_var_unit_prices' . substr( md5( json_encode( $hash ) ), 0, 22 ) . WC_Cache_Helper::get_transient_version( 'product' );
|
91 |
+
$this->unit_prices_array = get_transient( $cache_key );
|
92 |
+
|
93 |
+
if ( empty( $this->unit_prices_array ) ) {
|
94 |
+
$prices = array();
|
95 |
+
$regular_prices = array();
|
96 |
+
$sale_prices = array();
|
97 |
+
$tax_display_mode = get_option( 'woocommerce_tax_display_shop' );
|
98 |
+
$variation_ids = $this->get_children( true );
|
99 |
+
|
100 |
+
foreach ( $variation_ids as $variation_id ) {
|
101 |
+
if ( $variation = $this->get_child( $variation_id ) ) {
|
102 |
+
$price = apply_filters( 'woocommerce_gzd_variation_unit_prices_price', $variation->unit_price, $variation, $this );
|
103 |
+
$regular_price = apply_filters( 'woocommerce_gzd_variation_unit_prices_regular_price', $variation->unit_price_regular, $variation, $this );
|
104 |
+
$sale_price = apply_filters( 'woocommerce_gzd_variation_unit_prices_sale_price', $variation->unit_price_sale, $variation, $this );
|
105 |
+
|
106 |
+
// If sale price does not equal price, the product is not yet on sale
|
107 |
+
if ( $sale_price === $regular_price || $sale_price !== $price ) {
|
108 |
+
$sale_price = $regular_price;
|
109 |
+
}
|
110 |
+
|
111 |
+
// If we are getting prices for display, we need to account for taxes
|
112 |
+
if ( $display ) {
|
113 |
+
if ( 'incl' === $tax_display_mode ) {
|
114 |
+
$price = '' === $price ? '' : $variation->get_price_including_tax( 1, $price );
|
115 |
+
$regular_price = '' === $regular_price ? '' : $variation->get_price_including_tax( 1, $regular_price );
|
116 |
+
$sale_price = '' === $sale_price ? '' : $variation->get_price_including_tax( 1, $sale_price );
|
117 |
+
} else {
|
118 |
+
$price = '' === $price ? '' : $variation->get_price_excluding_tax( 1, $price );
|
119 |
+
$regular_price = '' === $regular_price ? '' : $variation->get_price_excluding_tax( 1, $regular_price );
|
120 |
+
$sale_price = '' === $sale_price ? '' : $variation->get_price_excluding_tax( 1, $sale_price );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$prices[ $variation_id ] = $price;
|
125 |
+
$regular_prices[ $variation_id ] = $regular_price;
|
126 |
+
$sale_prices[ $variation_id ] = $sale_price;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
asort( $prices );
|
131 |
+
asort( $regular_prices );
|
132 |
+
asort( $sale_prices );
|
133 |
+
|
134 |
+
$this->unit_prices_array = array(
|
135 |
+
'price' => $prices,
|
136 |
+
'regular_price' => $regular_prices,
|
137 |
+
'sale_price' => $sale_prices
|
138 |
+
);
|
139 |
+
|
140 |
+
set_transient( $cache_key, $this->unit_prices_array, DAY_IN_SECONDS * 30 );
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Give plugins one last chance to filter the variation prices array.
|
145 |
+
*/
|
146 |
+
return $this->unit_prices_array = apply_filters( 'woocommerce_gzd_variation_unit_prices', $this->unit_prices_array, $this, $display );
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, german market, german, germany, deutsch, deutschland, de, de_
|
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=info@vendidero.de&item_name=Donation+for+WooCommerce+Germanized
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -43,7 +43,7 @@ Zudem haben wir einige Anpassungen am Bezahlvorgang vorgenommen, damit dein WooC
|
|
43 |
= Trusted Shops vorzertifiziert =
|
44 |
WC Germanized wurde von Trusted Shops vorzertifiziert und bietet damit die optimalen technischen Voraussetzungen für einen rechtssicheren Online-Shop mit WooCommerce in Deutschland.
|
45 |
Trusted Shops zertifiziert Online-Shops nach sorgfältig ausgewählten Qualitätskriterien und hat das WooCommerce Plugin genau unter die Lupe genommen.
|
46 |
-
Selbstverständlich können Trusted Shops Kunden mit nur wenigen Einstellungen das Gütesiegel und die Trusted Shops Produkte mit
|
47 |
|
48 |
= Sauber implementiert =
|
49 |
Bei der Entwicklung von WC Germanized haben wir besonderes Augenmerk auf die nahtlose Integration in WooCommerce gelegt.
|
@@ -176,6 +176,11 @@ Bugs sowie Hilfe bei der Arbeit an WooCommerce Germanized werden gerne über uns
|
|
176 |
|
177 |
== Changelog ==
|
178 |
|
|
|
|
|
|
|
|
|
|
|
179 |
= 1.4.4 =
|
180 |
* Fix - in_array default option checkout
|
181 |
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=info@vendidero.de&item_name=Donation+for+WooCommerce+Germanized
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 1.4.5
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
43 |
= Trusted Shops vorzertifiziert =
|
44 |
WC Germanized wurde von Trusted Shops vorzertifiziert und bietet damit die optimalen technischen Voraussetzungen für einen rechtssicheren Online-Shop mit WooCommerce in Deutschland.
|
45 |
Trusted Shops zertifiziert Online-Shops nach sorgfältig ausgewählten Qualitätskriterien und hat das WooCommerce Plugin genau unter die Lupe genommen.
|
46 |
+
Selbstverständlich können Trusted Shops Kunden mit nur wenigen Einstellungen das Gütesiegel und die Trusted Shops Produkte mit WooCommerce Germanized nutzen.
|
47 |
|
48 |
= Sauber implementiert =
|
49 |
Bei der Entwicklung von WC Germanized haben wir besonderes Augenmerk auf die nahtlose Integration in WooCommerce gelegt.
|
176 |
|
177 |
== Changelog ==
|
178 |
|
179 |
+
= 1.4.5 =
|
180 |
+
* Feature - WC_GZD_Product_Variable object containing get_variation_unit_price with min max option
|
181 |
+
* Fix - virtual vat calculation (vat exempt compatibility)
|
182 |
+
* Fix - email object $type check
|
183 |
+
|
184 |
= 1.4.4 =
|
185 |
* Fix - in_array default option checkout
|
186 |
|
woocommerce-germanized.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WooCommerce Germanized
|
4 |
* Plugin URI: https://www.vendidero.de/woocommerce-germanized
|
5 |
* Description: Extends WooCommerce to become a legally compliant store for the german market.
|
6 |
-
* Version: 1.4.
|
7 |
* Author: Vendidero
|
8 |
* Author URI: https://vendidero.de
|
9 |
* Requires at least: 3.8
|
@@ -26,7 +26,7 @@ final class WooCommerce_Germanized {
|
|
26 |
*
|
27 |
* @var string
|
28 |
*/
|
29 |
-
public $version = '1.4.
|
30 |
|
31 |
/**
|
32 |
* Single instance of WooCommerce Germanized Main Class
|
@@ -183,7 +183,9 @@ final class WooCommerce_Germanized {
|
|
183 |
//add_filter( 'woocommerce_rate_code', array( $this, 'prevent_tax_name_merge' ), PHP_INT_MAX, 2 );
|
184 |
|
185 |
// Adjust virtual Product Price and tax class
|
186 |
-
add_filter( '
|
|
|
|
|
187 |
// Fallback gzd_product injection if not using wc_get_product
|
188 |
add_filter( 'get_post_metadata', array( $this, 'inject_gzd_product' ), 0, 4 );
|
189 |
|
@@ -823,25 +825,84 @@ final class WooCommerce_Germanized {
|
|
823 |
}
|
824 |
|
825 |
/**
|
826 |
-
*
|
827 |
-
*
|
828 |
-
* @param float $price
|
829 |
-
* @param int $qty
|
830 |
-
* @param object $product
|
831 |
-
* @return adjusted price
|
832 |
*/
|
833 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
834 |
|
835 |
-
|
836 |
-
|
837 |
|
838 |
-
|
839 |
-
return $price;
|
840 |
|
841 |
-
|
842 |
-
|
|
|
|
|
|
|
|
|
|
|
843 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
return $price;
|
|
|
845 |
}
|
846 |
|
847 |
/**
|
3 |
* Plugin Name: WooCommerce Germanized
|
4 |
* Plugin URI: https://www.vendidero.de/woocommerce-germanized
|
5 |
* Description: Extends WooCommerce to become a legally compliant store for the german market.
|
6 |
+
* Version: 1.4.5
|
7 |
* Author: Vendidero
|
8 |
* Author URI: https://vendidero.de
|
9 |
* Requires at least: 3.8
|
26 |
*
|
27 |
* @var string
|
28 |
*/
|
29 |
+
public $version = '1.4.5';
|
30 |
|
31 |
/**
|
32 |
* Single instance of WooCommerce Germanized Main Class
|
183 |
//add_filter( 'woocommerce_rate_code', array( $this, 'prevent_tax_name_merge' ), PHP_INT_MAX, 2 );
|
184 |
|
185 |
// Adjust virtual Product Price and tax class
|
186 |
+
add_filter( 'woocommerce_cart_product_subtotal', array( $this, 'set_virtual_cart_subtotal' ), 20, 4 );
|
187 |
+
add_filter( 'woocommerce_get_price_including_tax', array( $this, 'set_virtual_price_for_vat_exempts' ), 10, 3 );
|
188 |
+
|
189 |
// Fallback gzd_product injection if not using wc_get_product
|
190 |
add_filter( 'get_post_metadata', array( $this, 'inject_gzd_product' ), 0, 4 );
|
191 |
|
825 |
}
|
826 |
|
827 |
/**
|
828 |
+
* Adjust line subtotal for virtual products
|
|
|
|
|
|
|
|
|
|
|
829 |
*/
|
830 |
+
public function set_virtual_cart_subtotal( $product_subtotal, $_product, $quantity, $cart ) {
|
831 |
+
|
832 |
+
if ( ! $_product->gzd_product->is_virtual_vat_exception() || ! $cart->is_virtual_taxable() )
|
833 |
+
return $product_subtotal;
|
834 |
+
|
835 |
+
if ( WC()->cart->prices_include_tax ) {
|
836 |
+
|
837 |
+
/**
|
838 |
+
* Calculate new net price based on item tax rates
|
839 |
+
*/
|
840 |
+
if ( WC()->customer && WC()->customer->is_vat_exempt() ) {
|
841 |
+
|
842 |
+
$tax_rates = array();
|
843 |
+
$shop_tax_rates = array();
|
844 |
+
|
845 |
+
// Get base tax rates
|
846 |
+
if ( empty( $shop_tax_rates[ $_product->tax_class ] ) ) {
|
847 |
+
$shop_tax_rates[ $_product->tax_class ] = WC_Tax::get_base_tax_rates( $_product->tax_class );
|
848 |
+
}
|
849 |
+
|
850 |
+
// Get item tax rates
|
851 |
+
if ( empty( $tax_rates[ $_product->get_tax_class() ] ) ) {
|
852 |
+
$tax_rates[ $_product->get_tax_class() ] = WC_Tax::get_rates( $_product->get_tax_class() );
|
853 |
+
}
|
854 |
+
|
855 |
+
$base_tax_rates = $shop_tax_rates[ $_product->tax_class ];
|
856 |
+
$item_tax_rates = $tax_rates[ $_product->get_tax_class() ];
|
857 |
|
858 |
+
$taxes = WC_Tax::calc_tax( $_product->get_price(), $item_tax_rates, true, true );
|
859 |
+
$product_subtotal = $_product->get_price() - array_sum( $taxes );
|
860 |
|
861 |
+
} else {
|
|
|
862 |
|
863 |
+
$product_subtotal = $_product->get_price() * $quantity;
|
864 |
+
|
865 |
+
}
|
866 |
+
|
867 |
+
}
|
868 |
+
|
869 |
+
return wc_price( $product_subtotal );
|
870 |
|
871 |
+
}
|
872 |
+
|
873 |
+
/**
|
874 |
+
* Adjust prices (including tax) for virtual products
|
875 |
+
*/
|
876 |
+
public function set_virtual_price_for_vat_exempts( $price, $qty, $product ) {
|
877 |
+
|
878 |
+
if ( $product->gzd_product && $product->gzd_product->is_virtual_vat_exception() && $product->is_taxable() ) {
|
879 |
+
|
880 |
+
if ( get_option( 'woocommerce_prices_include_tax' ) === 'yes' ) {
|
881 |
+
|
882 |
+
if ( ! empty( WC()->customer ) && WC()->customer->is_vat_exempt() ) {
|
883 |
+
|
884 |
+
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
885 |
+
$base_tax_rates = WC_Tax::get_base_tax_rates( $product->tax_class );
|
886 |
+
|
887 |
+
// Add default rates to get original gross price
|
888 |
+
$base_taxes = WC_Tax::calc_tax( $price, $base_tax_rates );
|
889 |
+
$base_tax_amount = array_sum( $base_taxes );
|
890 |
+
$price = round( $price + $base_tax_amount, wc_get_price_decimals() );
|
891 |
+
|
892 |
+
// Substract product tax rates (e.g. 20 percent if customer is from AT)
|
893 |
+
$product_tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
894 |
+
$product_taxes = WC_Tax::calc_tax( $price, $product_tax_rates, true, true );
|
895 |
+
$product_tax_amount = array_sum( $product_taxes );
|
896 |
+
$price = round( $price - $product_tax_amount, wc_get_price_decimals() );
|
897 |
+
|
898 |
+
}
|
899 |
+
|
900 |
+
}
|
901 |
+
|
902 |
+
}
|
903 |
+
|
904 |
return $price;
|
905 |
+
|
906 |
}
|
907 |
|
908 |
/**
|