Title: Errore php
Last modified: April 1, 2026

---

# Errore php

 *  [appteam](https://wordpress.org/support/users/appteam/)
 * (@appteam)
 * [2 months, 1 week ago](https://wordpress.org/support/topic/errore-php/)
 * [01-Apr-2026 09:11:34 UTC] PHP 16. WooCommerce_Italian_add_on_plus->piva_checkout_field_process(”)/
   home/_**/public\_html/wp-includes/class-wp-hook.php:341 [01-Apr-2026 09:11:34
   UTC] PHP 15. WP\_Hook->apply\_filters($value = ”, $args = [0 => ”]) /home/**_/
   public_html/wp-includes/class-wp-hook.php:365
   [01-Apr-2026 09:11:34 UTC] PHP 
   14. WP_Hook->do_action($args = [0 => ”]) /home/_**/public\_html/wp-includes/plugin.
   php:522 [01-Apr-2026 09:11:34 UTC] PHP 13. do\_action($hook\_name = ‘woocommerce\
   _checkout\_process’) /home/**_/public_html/wp-content/plugins/woocommerce/includes/
   class-wc-checkout.php:1303[01-Apr-2026 09:11:34 UTC] PHP 12. WC_Checkout->process_checkout()/
   home/_**/public\_html/wp-content/plugins/woocommerce/includes/class-wc-ajax.php:
   596 [01-Apr-2026 09:11:34 UTC] PHP 11. WC\_AJAX::checkout(”) /home/**_/public_html/
   wp-includes/class-wp-hook.php:341[01-Apr-2026 09:11:34 UTC] PHP 10. WP_Hook->
   apply_filters($value = ”, $args = [0 => ”]) /home/_**/public\_html/wp-includes/
   class-wp-hook.php:365 [01-Apr-2026 09:11:34 UTC] PHP 9. WP\_Hook->do\_action(
   $args = [0 => ”]) /home/**_/public_html/wp-includes/plugin.php:522[01-Apr-2026
   09:11:34 UTC] PHP 8. do_action($hook_name = ‘wc_ajax_checkout’) /home/_**/public\
   _html/wp-content/plugins/woocommerce/includes/class-wc-ajax.php:127 [01-Apr-2026
   09:11:34 UTC] PHP 7. WC\_AJAX::do\_wc\_ajax(”) /home/**_/public_html/wp-includes/
   class-wp-hook.php:341[01-Apr-2026 09:11:34 UTC] PHP 6. WP_Hook->apply_filters(
   $value = ”, $args = [0 => ”]) /home/_**/public\_html/wp-includes/class-wp-hook.
   php:365 [01-Apr-2026 09:11:34 UTC] PHP 5. WP\_Hook->do\_action($args = [0 => ”])/
   home/**_/public_html/wp-includes/plugin.php:522[01-Apr-2026 09:11:34 UTC] PHP
   4. do_action($hook_name = ‘template_redirect’) /home/_**/public\_html/wp-includes/
   template-loader.php:23 [01-Apr-2026 09:11:34 UTC] PHP 3. require\_once() /home/**_/
   public_html/wp-blog-header.php:19[01-Apr-2026 09:11:34 UTC] PHP 2. require() /
   home/_**/public\_html/index.php:17 [01-Apr-2026 09:11:34 UTC] PHP 1. {main}()/
   home/**_/public_html/index.php:0[01-Apr-2026 09:11:34 UTC] PHP Stack trace:[01-
   Apr-2026 09:11:34 UTC] PHP Warning: Undefined array key “base_country” in /home/*/
   public_html/wp-content/plugins/woocommerce-italian-add-on/woocommerce-italian-
   add-on.php on line 856

Viewing 1 replies (of 1 total)

 *  Thread Starter [appteam](https://wordpress.org/support/users/appteam/)
 * (@appteam)
 * [2 months, 1 week ago](https://wordpress.org/support/topic/errore-php/#post-18868943)
 * Correzioni applicate a “WooCommerce Italian Add-on Plus” (per passaggio allo 
   sviluppatore)
 * Obiettivo
    - Eliminare il fatal in export XML: “Cannot access offset of type string on 
      string” (accesso a $document_data[“fn”])
    - Eliminare warning in checkout: “Undefined array key “base_country”” (in realtà
      manca billing/shipping country in $_POST)
 * 1) Fix fatal export XML (document_data coerente)
   File:
    - wp-content/plugins/woocommerce-italian-add-on/includes/class-wc-settings-export.
      php
 * 1A. Validazione meta _wcpdf_IT_document_data
   Motivo:
    - $order->get_meta(‘_wcpdf_IT_document_data’, true) può ritornare una stringa/
      bool; il codice lo trattava come array.
 * Modifica (nel ramo “else”, vicino alla lettura del meta):
   PRIMA:$document_data
   = $order->get_meta( ‘_wcpdf_IT_document_data’, true );if ( $document_data ) {
   $number_formatted = $document_data[“number_formatted”];$number = $document_data[“
   number”];$date = $document_data[“date”];…}
 * DOPO:
   $document_data = $order->get_meta( ‘_wcpdf_IT_document_data’, true );if(
   is_array( $document_data ) && $document_data ) {$number_formatted = empty( $document_data[“
   number_formatted”] ) ? “” : $document_data[“number_formatted”];$number = empty(
   $document_data[“number”] ) ? “” : $document_data[“number”];$date = empty( $document_data[“
   date”] ) ? “” : $document_data[“date”];…}
 * 1B. get_document_data() restituisce sempre un array
   Motivo:
    - get_document_data() ritornava “” quando non trovava dati; crea_xml() poi faceva
      $document_data[“fn”] causando fatal.
 * Modifica (a fine get_document_data()):
   PRIMA:$res = “”;if ( $number_formatted){
   $date_formatted = empty( $date ) ? “” : date( “Y-m-d”, strtotime( $date ) );$
   res = array( “num” => $number_formatted, “data” => $date_formatted, “fn” => $
   fname, “type” => $document_type );}return $res;
 * DOPO:
   $res = array( “num” => “”, “data” => “”, “fn” => $fname, “type” => $document_type);
   if ( $number_formatted ) {$date_formatted = empty( $date ) ? “” : date( “Y-m-
   d”, strtotime( $date ) );$res[“num”] = $number_formatted;$res[“data”] = $date_formatted;}
   return $res;
 * Impatto:
    - crea_xml() può sempre fare $document_data[“fn”] senza rischiare accesso a 
      offset su stringa.
 * 2) Fix warning “base_country” in checkout (fallback country in $_POST)
   File:
    - wp-content/plugins/woocommerce-italian-add-on/woocommerce-italian-add-on.php
 * Punto:
    - Funzione piva_checkout_field_process()
 * Motivo:
    - $_POST[$tax_based_on_country] (billing_country o shipping_country) può non
      arrivare in alcuni flussi; il codice lo usa senza check.
 * Modifica (subito dopo la definizione di $tax_based_on_country):
   AGGIUNTA:$tax_based_on_country
   = $tax_based_on . “_country”;if ( empty( $_POST[ $tax_based_on_country ] ) ) {
   $_POST[ $tax_based_on_country ] = $this->default_country;}
 * Impatto:
    - Evita accessi a chiavi inesistenti in $_POST e quindi elimina i warning relativi.
 *  -  This reply was modified 2 months, 1 week ago by [appteam](https://wordpress.org/support/users/appteam/).

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferrore-php%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-italian-add-on/assets/icon-256x256.
   jpg?rev=1058945)
 * [PDF Invoices Italian Add-on for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-italian-add-on/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-italian-add-on/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-italian-add-on/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-italian-add-on/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-italian-add-on/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-italian-add-on/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [appteam](https://wordpress.org/support/users/appteam/)
 * Last activity: [2 months, 1 week ago](https://wordpress.org/support/topic/errore-php/#post-18868943)
 * Status: not resolved