PHP Notice: Undefined offset: 0 für WooCommerce Subscriptions
-
Hi,
auf meinem Test-System (lokaler Staging Server) erhalte ich folgende
PHP Notice
, wenn ich eine Variable Subscription mit 2 x 3 Optionen (3 Farben, 3 Gr??en) in den Warenkorb hinzufügen m?chte:PHP Notice: Undefined offset: 0 in /var/www/html/wp-content/plugins/woocommerce-germanized/packages/woocommerce-germanized-dhl/includes/wc-gzd-dhl-core-functions.php on line 234, referer: https://my-site.test/shop/mein-abo/ PHP Stack trace:, referer: https://my-site.test/shop/mein-abo/ PHP 1. {main}() /var/www/html/index.php:0, referer: https://my-site.test/shop/mein-abo/ PHP 2. require() /var/www/html/index.php:17, referer: https://my-site.test/shop/mein-abo/ PHP 3. require_once() /var/www/html/wp-blog-header.php:13, referer: https://my-site.test/shop/mein-abo/ PHP 4. require_once() /var/www/html/wp-load.php:50, referer: https://my-site.test/shop/mein-abo/ PHP 5. require_once() /var/www/html/wp-config.php:98, referer: https://my-site.test/shop/mein-abo/ PHP 6. do_action($hook_name = 'wp_loaded') /var/www/html/wp-settings.php:600, referer: https://my-site.test/shop/mein-abo/ PHP 7. WP_Hook->do_action($args = [0 => '']) /var/www/html/wp-includes/plugin.php:470, referer: https://my-site.test/shop/mein-abo/ PHP 8. WP_Hook->apply_filters($value = '', $args = [0 => '']) /var/www/html/wp-includes/class-wp-hook.php:327, referer: https://my-site.test/shop/mein-abo/ PHP 9. WC_Form_Handler::add_to_cart_action($url = '') /var/www/html/wp-includes/class-wp-hook.php:303, referer: https://my-site.test/shop/mein-abo/ PHP 10. WC_Form_Handler::add_to_cart_handler_variable($product_id = 4997) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:790, referer: https://my-site.test/shop/mein-abo/ PHP 11. WC_Cart->add_to_cart($product_id = 4997, $quantity = 1, $variation_id = 5004, $variation = ['attribute_pa_menge' => '2-x-250g', 'attribute_pa_abo-art' => 'gemischt'], $cart_item_data = *uninitialized*) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:918, referer: https://my-site.test/shop/mein-abo/ PHP 12. do_action($hook_name = 'woocommerce_add_to_cart', ...$arg = variadic('b3f0fb010b84d639ed99904b81600617', 4997, 1, 5004, ['attribute_pa_menge' => '2-x-250g', 'attribute_pa_abo-art' => 'gemischt'], [])) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1276, referer: https://my-site.test/shop/mein-abo/ PHP 13. WP_Hook->do_action($args = [0 => 'b3f0fb010b84d639ed99904b81600617', 1 => 4997, 2 => 1, 3 => 5004, 4 => ['attribute_pa_menge' => '2-x-250g', 'attribute_pa_abo-art' => 'gemischt'], 5 => []]) /var/www/html/wp-includes/plugin.php:470, referer: https://my-site.test/shop/mein-abo/ PHP 14. WP_Hook->apply_filters($value = '', $args = [0 => 'b3f0fb010b84d639ed99904b81600617', 1 => 4997, 2 => 1, 3 => 5004, 4 => ['attribute_pa_menge' => '2-x-250g', 'attribute_pa_abo-art' => 'gemischt'], 5 => []]) /var/www/html/wp-includes/class-wp-hook.php:327, referer: https://my-site.test/shop/mein-abo/ PHP 15. WC_Cart->calculate_totals() /var/www/html/wp-includes/class-wp-hook.php:301, referer: https://my-site.test/shop/mein-abo/ PHP 16. WC_Cart_Totals->__construct($cart = class WC_Cart { public $cart_contents = ['77edbe5f897a5dbcde49d31bec1537b8' => [...], 'b3f0fb010b84d639ed99904b81600617' => [...]]; public $removed_cart_contents = []; public $applied_coupons = []; protected $shipping_methods = []; protected $default_totals = ['subtotal' => 0, 'subtotal_tax' => 0, 'shipping_total' => 0, 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => 0, 'cart_contents_tax' => 0, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $totals = ['subtotal' => '16.81', 'subtotal_tax' => 3.19, 'shipping_total' => '0', 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => '16.81', 'cart_contents_tax' => 3.19, 'cart_contents_taxes' => [...], 'fee_total' => '0', 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => '20.00', 'total_tax' => 3.19]; protected $session = class WC_Cart_Session { protected $cart = ... }; protected $fees_api = class WC_Cart_Fees { private $fees = [...]; private $cart = ...; private $default_fee_props = [...] }; public $cart_session_data = ['cart_contents_total' => 0, 'total' => 0, 'subtotal' => 0, 'subtotal_ex_tax' => 0, 'tax_total' => 0, 'taxes' => [...], 'shipping_taxes' => [...], 'discount_cart' => 0, 'discount_cart_tax' => 0, 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => [...], 'coupon_discount_tax_amounts' => [...], 'fee_total' => 0, 'fees' => [...]]; public $coupon_applied_count = []; public $coupon_discount_totals = []; public $coupon_discount_tax_totals = []; public $recurring_carts = [] }) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1398, referer: https://my-site.test/shop/mein-abo/ PHP 17. WC_Cart_Totals->calculate() /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:134, referer: https://my-site.test/shop/mein-abo/ PHP 18. WC_Cart_Totals->calculate_totals() /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:146, referer: https://my-site.test/shop/mein-abo/ PHP 19. apply_filters($hook_name = 'woocommerce_calculated_total', $value = 20, class WC_Cart { public $cart_contents = ['77edbe5f897a5dbcde49d31bec1537b8' => [...], 'b3f0fb010b84d639ed99904b81600617' => [...]]; public $removed_cart_contents = []; public $applied_coupons = []; protected $shipping_methods = []; protected $default_totals = ['subtotal' => 0, 'subtotal_tax' => 0, 'shipping_total' => 0, 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => 0, 'cart_contents_tax' => 0, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $totals = ['subtotal' => '16.81', 'subtotal_tax' => 3.19, 'shipping_total' => '0', 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => '16.81', 'cart_contents_tax' => 3.19, 'cart_contents_taxes' => [...], 'fee_total' => '0', 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => '20.00', 'total_tax' => 3.19]; protected $session = class WC_Cart_Session { protected $cart = ... }; protected $fees_api = class WC_Cart_Fees { private $fees = [...]; private $cart = ...; private $default_fee_props = [...] }; public $cart_session_data = ['cart_contents_total' => 0, 'total' => 0, 'subtotal' => 0, 'subtotal_ex_tax' => 0, 'tax_total' => 0, 'taxes' => [...], 'shipping_taxes' => [...], 'discount_cart' => 0, 'discount_cart_tax' => 0, 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => [...], 'coupon_discount_tax_amounts' => [...], 'fee_total' => 0, 'fees' => [...]]; public $coupon_applied_count = []; public $coupon_discount_totals = []; public $coupon_discount_tax_totals = []; public $recurring_carts = [] }) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:877, referer: https://my-site.test/shop/mein-abo/ PHP 20. WP_Hook->apply_filters($value = 20, $args = [0 => 20, 1 => class WC_Cart { public $cart_contents = [...]; public $removed_cart_contents = [...]; public $applied_coupons = [...]; protected $shipping_methods = [...]; protected $default_totals = [...]; protected $totals = [...]; protected $session = class WC_Cart_Session { ... }; protected $fees_api = class WC_Cart_Fees { ... }; public $cart_session_data = [...]; public $coupon_applied_count = [...]; public $coupon_discount_totals = [...]; public $coupon_discount_tax_totals = [...]; public $recurring_carts = [...] }]) /var/www/html/wp-includes/plugin.php:189, referer: https://my-site.test/shop/mein-abo/ PHP 21. WC_Subscriptions_Cart::calculate_subscription_totals($total = 20, $cart = class WC_Cart { public $cart_contents = ['77edbe5f897a5dbcde49d31bec1537b8' => [...], 'b3f0fb010b84d639ed99904b81600617' => [...]]; public $removed_cart_contents = []; public $applied_coupons = []; protected $shipping_methods = []; protected $default_totals = ['subtotal' => 0, 'subtotal_tax' => 0, 'shipping_total' => 0, 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => 0, 'cart_contents_tax' => 0, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $totals = ['subtotal' => '16.81', 'subtotal_tax' => 3.19, 'shipping_total' => '0', 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => '16.81', 'cart_contents_tax' => 3.19, 'cart_contents_taxes' => [...], 'fee_total' => '0', 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => '20.00', 'total_tax' => 3.19]; protected $session = class WC_Cart_Session { protected $cart = ... }; protected $fees_api = class WC_Cart_Fees { private $fees = [...]; private $cart = ...; private $default_fee_props = [...] }; public $cart_session_data = ['cart_contents_total' => 0, 'total' => 0, 'subtotal' => 0, 'subtotal_ex_tax' => 0, 'tax_total' => 0, 'taxes' => [...], 'shipping_taxes' => [...], 'discount_cart' => 0, 'discount_cart_tax' => 0, 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => [...], 'coupon_discount_tax_amounts' => [...], 'fee_total' => 0, 'fees' => [...]]; public $coupon_applied_count = []; public $coupon_discount_totals = []; public $coupon_discount_tax_totals = []; public $recurring_carts = [] }) /var/www/html/wp-includes/class-wp-hook.php:303, referer: https://my-site.test/shop/mein-abo/ PHP 22. WC_Cart->calculate_totals() /var/www/html/wp-content/plugins/woocommerce-subscriptions/includes/class-wc-subscriptions-cart.php:322, referer: https://my-site.test/shop/mein-abo/ PHP 23. WC_Cart_Totals->__construct($cart = class WC_Cart { public $cart_contents = ['b3f0fb010b84d639ed99904b81600617' => [...]]; public $removed_cart_contents = []; public $applied_coupons = []; protected $shipping_methods = ['2022_01_01_monthly_synced_0' => class WC_Shipping_Rate { ... }]; protected $default_totals = ['subtotal' => 0, 'subtotal_tax' => 0, 'shipping_total' => 0, 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => 0, 'cart_contents_tax' => 0, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $totals = ['subtotal' => '16.73', 'subtotal_tax' => 1.17, 'shipping_total' => '0', 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => '16.73', 'cart_contents_tax' => 1.17, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $session = class WC_Cart_Session { protected $cart = class WC_Cart { ... } }; protected $fees_api = class WC_Cart_Fees { private $fees = [...]; private $cart = class WC_Cart { ... }; private $default_fee_props = [...] }; public $cart_session_data = ['cart_contents_total' => 0, 'total' => 0, 'subtotal' => 0, 'subtotal_ex_tax' => 0, 'tax_total' => 0, 'taxes' => [...], 'shipping_taxes' => [...], 'discount_cart' => 0, 'discount_cart_tax' => 0, 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => [...], 'coupon_discount_tax_amounts' => [...], 'fee_total' => 0, 'fees' => [...]]; public $coupon_applied_count = []; public $coupon_discount_totals = []; public $coupon_discount_tax_totals = []; public $recurring_carts = []; public $recurring_cart_key = '2022_01_01_monthly_synced'; public $start_date = '2021-12-06 06:45:21'; public $trial_end_date = 0; public $next_payment_date = '2022-01-01 02:00:00'; public $end_date = 0 }) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1398, referer: https://my-site.test/shop/mein-abo/ PHP 24. WC_Cart_Totals->calculate() /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:134, referer: https://my-site.test/shop/mein-abo/ PHP 25. WC_Cart_Totals->calculate_fee_totals() /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:145, referer: https://my-site.test/shop/mein-abo/ PHP 26. WC_Cart_Totals->get_fees_from_cart() /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:833, referer: https://my-site.test/shop/mein-abo/ PHP 27. WC_Cart->calculate_fees() /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:272, referer: https://my-site.test/shop/mein-abo/ PHP 28. do_action($hook_name = 'woocommerce_cart_calculate_fees', ...$arg = variadic(class WC_Cart { public $cart_contents = ['b3f0fb010b84d639ed99904b81600617' => [...]]; public $removed_cart_contents = []; public $applied_coupons = []; protected $shipping_methods = ['2022_01_01_monthly_synced_0' => class WC_Shipping_Rate { ... }]; protected $default_totals = ['subtotal' => 0, 'subtotal_tax' => 0, 'shipping_total' => 0, 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => 0, 'cart_contents_tax' => 0, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $totals = ['subtotal' => '16.73', 'subtotal_tax' => 1.17, 'shipping_total' => '0', 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => '16.73', 'cart_contents_tax' => 1.17, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $session = class WC_Cart_Session { protected $cart = class WC_Cart { ... } }; protected $fees_api = class WC_Cart_Fees { private $fees = [...]; private $cart = class WC_Cart { ... }; private $default_fee_props = [...] }; public $cart_session_data = ['cart_contents_total' => 0, 'total' => 0, 'subtotal' => 0, 'subtotal_ex_tax' => 0, 'tax_total' => 0, 'taxes' => [...], 'shipping_taxes' => [...], 'discount_cart' => 0, 'discount_cart_tax' => 0, 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => [...], 'coupon_discount_tax_amounts' => [...], 'fee_total' => 0, 'fees' => [...]]; public $coupon_applied_count = []; public $coupon_discount_totals = []; public $coupon_discount_tax_totals = []; public $recurring_carts = []; public $recurring_cart_key = '2022_01_01_monthly_synced'; public $start_date = '2021-12-06 06:45:21'; public $trial_end_date = 0; public $next_payment_date = '2022-01-01 02:00:00'; public $end_date = 0 })) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1885, referer: https://my-site.test/shop/mein-abo/ PHP 29. WP_Hook->do_action($args = [0 => class WC_Cart { public $cart_contents = [...]; public $removed_cart_contents = [...]; public $applied_coupons = [...]; protected $shipping_methods = [...]; protected $default_totals = [...]; protected $totals = [...]; protected $session = class WC_Cart_Session { ... }; protected $fees_api = class WC_Cart_Fees { ... }; public $cart_session_data = [...]; public $coupon_applied_count = [...]; public $coupon_discount_totals = [...]; public $coupon_discount_tax_totals = [...]; public $recurring_carts = [...]; public $recurring_cart_key = '2022_01_01_monthly_synced'; public $start_date = '2021-12-06 06:45:21'; public $trial_end_date = 0; public $next_payment_date = '2022-01-01 02:00:00'; public $end_date = 0 }]) /var/www/html/wp-includes/plugin.php:470, referer: https://my-site.test/shop/mein-abo/ PHP 30. WP_Hook->apply_filters($value = '', $args = [0 => class WC_Cart { public $cart_contents = [...]; public $removed_cart_contents = [...]; public $applied_coupons = [...]; protected $shipping_methods = [...]; protected $default_totals = [...]; protected $totals = [...]; protected $session = class WC_Cart_Session { ... }; protected $fees_api = class WC_Cart_Fees { ... }; public $cart_session_data = [...]; public $coupon_applied_count = [...]; public $coupon_discount_totals = [...]; public $coupon_discount_tax_totals = [...]; public $recurring_carts = [...]; public $recurring_cart_key = '2022_01_01_monthly_synced'; public $start_date = '2021-12-06 06:45:21'; public $trial_end_date = 0; public $next_payment_date = '2022-01-01 02:00:00'; public $end_date = 0 }]) /var/www/html/wp-includes/class-wp-hook.php:327, referer: https://my-site.test/shop/mein-abo/ PHP 31. Vendidero\\Germanized\\DHL\\ParcelServices::add_fees($cart = class WC_Cart { public $cart_contents = ['b3f0fb010b84d639ed99904b81600617' => [...]]; public $removed_cart_contents = []; public $applied_coupons = []; protected $shipping_methods = ['2022_01_01_monthly_synced_0' => class WC_Shipping_Rate { ... }]; protected $default_totals = ['subtotal' => 0, 'subtotal_tax' => 0, 'shipping_total' => 0, 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => 0, 'cart_contents_tax' => 0, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $totals = ['subtotal' => '16.73', 'subtotal_tax' => 1.17, 'shipping_total' => '0', 'shipping_tax' => 0, 'shipping_taxes' => [...], 'discount_total' => 0, 'discount_tax' => 0, 'cart_contents_total' => '16.73', 'cart_contents_tax' => 1.17, 'cart_contents_taxes' => [...], 'fee_total' => 0, 'fee_tax' => 0, 'fee_taxes' => [...], 'total' => 0, 'total_tax' => 0]; protected $session = class WC_Cart_Session { protected $cart = class WC_Cart { ... } }; protected $fees_api = class WC_Cart_Fees { private $fees = [...]; private $cart = class WC_Cart { ... }; private $default_fee_props = [...] }; public $cart_session_data = ['cart_contents_total' => 0, 'total' => 0, 'subtotal' => 0, 'subtotal_ex_tax' => 0, 'tax_total' => 0, 'taxes' => [...], 'shipping_taxes' => [...], 'discount_cart' => 0, 'discount_cart_tax' => 0, 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => [...], 'coupon_discount_tax_amounts' => [...], 'fee_total' => 0, 'fees' => [...]]; public $coupon_applied_count = []; public $coupon_discount_totals = []; public $coupon_discount_tax_totals = []; public $recurring_carts = []; public $recurring_cart_key = '2022_01_01_monthly_synced'; public $start_date = '2021-12-06 06:45:21'; public $trial_end_date = 0; public $next_payment_date = '2022-01-01 02:00:00'; public $end_date = 0 }) /var/www/html/wp-includes/class-wp-hook.php:303, referer: https://my-site.test/shop/mein-abo/ PHP 32. Vendidero\\Germanized\\DHL\\ParcelServices::is_preferred_available($check_day_transfer = TRUE) /var/www/html/wp-content/plugins/woocommerce-germanized/packages/woocommerce-germanized-dhl/src/ParcelServices.php:127, referer: https://my-site.test/shop/mein-abo/ PHP 33. Vendidero\\Germanized\\DHL\\ParcelServices::is_preferred_enabled() /var/www/html/wp-content/plugins/woocommerce-germanized/packages/woocommerce-germanized-dhl/src/ParcelServices.php:224, referer: https://my-site.test/shop/mein-abo/ PHP 34. Vendidero\\Germanized\\DHL\\ParcelServices::is_preferred_day_enabled() /var/www/html/wp-content/plugins/woocommerce-germanized/packages/woocommerce-germanized-dhl/src/ParcelServices.php:213, referer: https://my-site.test/shop/mein-abo/ PHP 35. Vendidero\\Germanized\\DHL\\ParcelServices::get_setting($key = 'PreferredDay_enable') /var/www/html/wp-content/plugins/woocommerce-germanized/packages/woocommerce-germanized-dhl/src/ParcelServices.php:361, referer: https://my-site.test/shop/mein-abo/ PHP 36. wc_gzd_dhl_get_current_shipping_method() /var/www/html/wp-content/plugins/woocommerce-germanized/packages/woocommerce-germanized-dhl/src/ParcelServices.php:382, referer: https://my-site.test/shop/mein-abo/
Ich wei?, es ist kein Error, sondern nur eine Notice, sollte aber dennoch behoben werden…
Alles neueste Versionen.
Das ist diese Zeile hier:
if ( ! empty( $chosen_shipping_methods ) ) { $method = wc_gzd_dhl_get_shipping_method( $chosen_shipping_methods[0] ); return $method; }
Ich habe hier mal ein
print_f
eingefügt und das Array sieht an der Stelle so aus:$chosen_shipping_methods: Array ( [2022_01_01_monthly_synced_0] => free_shipping:2 )
Es ist also eher ein Dictionary bzw. eine Map statt eines 0-indexed Arrays.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Notice: Undefined offset: 0 für WooCommerce Subscriptions’ is closed to new replies.