• Resolved Chris

    (@osiak)


    Hello,
    I don’t understand why I’m getting an error like this on my Cart page when enabling the Local Pickup shipping option:

    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1237
    
    Warning: array_map(): Argument #2 should be an array in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 351
    
    Warning: array_sum() expects parameter 1 to be array, null given in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 351
    
    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 615
    
    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 575
    
    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 575
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Hari Shanker R

    (@harishanker)

    Hi @osiak

    I wanted to follow-up with you on the problem you had reported to us.

    I first took a look at the code attached to the warning messages that you had shared with me:

    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1237
    
    Warning: array_map(): Argument #2 should be an array in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 351
    
    Warning: array_sum() expects parameter 1 to be array, null given in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 351
    
    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 615
    
    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 575
    
    Warning: Invalid argument supplied for foreach() in /home/intelig/domains/inteligencjaoddechu.pl/public_html/wp/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php on line 575

    All these lines refer to tax calculations in WooCommerce. Here are some examples:
    https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-cart.php#L1237
    https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-cart-totals.php#L615

    It appears that the tax being passed along from the cart page seems to be having some problems. This could be due to a variety of reasons, but I suspect a conflict or a problem with your theme’s custom templates in the cart page.

    Could you please send me a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, you can paste it here in your reply to this thread and pass it along to us, please.

    We look forward to hearing from you.

    Thread Starter Chris

    (@osiak)

    Hi,
    this is my status report:

    
    ### WordPress Environment ###
    
    Home URL: ***
    Site URL: ***
    WC Version: 3.5.4
    Log Directory Writable: ✔
    WP Version: 5.0.3
    WP Multisite: –
    WP Memory Limit: 512 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: pl_PL
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: LiteSpeed
    PHP Version: 7.2.15
    PHP Post Max Size: 512 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 10000
    cURL Version: 7.62.0
    OpenSSL/1.0.2k
    
    SUHOSIN Installed: –
    MySQL Version: 5.6.39-83.1-cll-lve
    Max Upload Size: 512 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 3.5.4
    WC Database Prefix: intel_
    Total Database Size: 254.19MB
    Database Data Size: 234.61MB
    Database Index Size: 19.58MB
    intel_woocommerce_sessions: Data: 0.06MB + Index: 0.03MB
    intel_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
    intel_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
    intel_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
    intel_woocommerce_order_items: Data: 0.14MB + Index: 0.06MB
    intel_woocommerce_order_itemmeta: Data: 1.45MB + Index: 1.89MB
    intel_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
    intel_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
    intel_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
    intel_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
    intel_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
    intel_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
    intel_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
    intel_woocommerce_log: Data: 0.02MB + Index: 0.02MB
    intel_commentmeta: Data: 0.02MB + Index: 0.03MB
    intel_comments: Data: 1.52MB + Index: 0.53MB
    intel_email_user: Data: 0.02MB + Index: 0.00MB
    intel_failed_jobs: Data: 0.02MB + Index: 0.00MB
    intel_fb3d_pages: Data: 0.02MB + Index: 0.05MB
    intel_fca_eoi_activity: Data: 0.02MB + Index: 0.05MB
    intel_fca_eoi_subscribers: Data: 0.02MB + Index: 0.00MB
    intel_links: Data: 0.02MB + Index: 0.02MB
    intel_mailchimp_carts: Data: 0.02MB + Index: 0.00MB
    intel_mclean_refs: Data: 0.02MB + Index: 0.00MB
    intel_mclean_scan: Data: 0.02MB + Index: 0.00MB
    intel_ms_snippets: Data: 0.02MB + Index: 0.00MB
    intel_options: Data: 3.31MB + Index: 0.09MB
    intel_postmeta: Data: 96.14MB + Index: 5.78MB
    intel_posts: Data: 7.05MB + Index: 0.44MB
    intel_queue: Data: 0.02MB + Index: 0.00MB
    intel_snippets: Data: 0.02MB + Index: 0.00MB
    intel_termmeta: Data: 0.02MB + Index: 0.03MB
    intel_terms: Data: 0.02MB + Index: 0.03MB
    intel_term_relationships: Data: 0.08MB + Index: 0.05MB
    intel_term_taxonomy: Data: 0.02MB + Index: 0.03MB
    intel_usermeta: Data: 1.48MB + Index: 0.86MB
    intel_users: Data: 0.08MB + Index: 0.05MB
    intel_wc_download_log: Data: 0.02MB + Index: 0.03MB
    intel_wc_webhooks: Data: 0.02MB + Index: 0.02MB
    intel_weu_group27: Data: 0.02MB + Index: 0.00MB
    intel_weu_sent_email: Data: 22.52MB + Index: 0.00MB
    intel_weu_smtp_conf: Data: 0.02MB + Index: 0.00MB
    intel_weu_subscribers: Data: 0.02MB + Index: 0.00MB
    intel_weu_unsubscriber: Data: 0.02MB + Index: 0.00MB
    intel_weu_user_notification: Data: 0.02MB + Index: 0.00MB
    intel_wsal_metadata: Data: 6.52MB + Index: 2.52MB
    intel_wsal_occurrences: Data: 1.52MB + Index: 0.52MB
    intel_wsal_options: Data: 3.52MB + Index: 0.00MB
    intel_yikes_easy_mc_forms: Data: 0.02MB + Index: 0.00MB
    intel_yoast_seo_links: Data: 0.02MB + Index: 0.02MB
    intel_yoast_seo_meta: Data: 0.05MB + Index: 0.00MB
    intel_yumpu_documents: Data: 0.02MB + Index: 0.00MB
    wpstg0_commentmeta: Data: 0.02MB + Index: 0.03MB
    wpstg0_comments: Data: 0.25MB + Index: 0.31MB
    wpstg0_email_user: Data: 0.02MB + Index: 0.00MB
    wpstg0_failed_jobs: Data: 0.02MB + Index: 0.00MB
    wpstg0_fb3d_pages: Data: 0.02MB + Index: 0.05MB
    wpstg0_fca_eoi_activity: Data: 0.02MB + Index: 0.05MB
    wpstg0_fca_eoi_subscribers: Data: 0.02MB + Index: 0.00MB
    wpstg0_links: Data: 0.02MB + Index: 0.02MB
    wpstg0_mailchimp_carts: Data: 0.02MB + Index: 0.00MB
    wpstg0_mclean_refs: Data: 0.02MB + Index: 0.00MB
    wpstg0_mclean_scan: Data: 0.02MB + Index: 0.00MB
    wpstg0_options: Data: 1.52MB + Index: 0.14MB
    wpstg0_postmeta: Data: 71.52MB + Index: 3.03MB
    wpstg0_posts: Data: 5.52MB + Index: 0.25MB
    wpstg0_queue: Data: 0.02MB + Index: 0.00MB
    wpstg0_snippets: Data: 0.02MB + Index: 0.00MB
    wpstg0_termmeta: Data: 0.02MB + Index: 0.03MB
    wpstg0_terms: Data: 0.02MB + Index: 0.03MB
    wpstg0_term_relationships: Data: 0.02MB + Index: 0.02MB
    wpstg0_term_taxonomy: Data: 0.02MB + Index: 0.03MB
    wpstg0_usermeta: Data: 1.52MB + Index: 0.95MB
    wpstg0_users: Data: 0.08MB + Index: 0.05MB
    wpstg0_wc_download_log: Data: 0.02MB + Index: 0.03MB
    wpstg0_wc_webhooks: Data: 0.02MB + Index: 0.02MB
    wpstg0_weu_group27: Data: 0.02MB + Index: 0.00MB
    wpstg0_weu_sent_email: Data: 1.52MB + Index: 0.00MB
    wpstg0_weu_smtp_conf: Data: 0.02MB + Index: 0.00MB
    wpstg0_weu_subscribers: Data: 0.02MB + Index: 0.00MB
    wpstg0_weu_unsubscriber: Data: 0.02MB + Index: 0.00MB
    wpstg0_weu_user_notification: Data: 0.02MB + Index: 0.00MB
    wpstg0_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
    wpstg0_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
    wpstg0_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
    wpstg0_woocommerce_log: Data: 0.02MB + Index: 0.02MB
    wpstg0_woocommerce_order_itemmeta: Data: 1.52MB + Index: 0.63MB
    wpstg0_woocommerce_order_items: Data: 0.11MB + Index: 0.06MB
    wpstg0_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
    wpstg0_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
    wpstg0_woocommerce_sessions: Data: 0.38MB + Index: 0.02MB
    wpstg0_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
    wpstg0_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
    wpstg0_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
    wpstg0_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
    wpstg0_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
    wpstg0_wsal_metadata: Data: 0.16MB + Index: 0.08MB
    wpstg0_wsal_occurrences: Data: 0.02MB + Index: 0.02MB
    wpstg0_wsal_options: Data: 3.52MB + Index: 0.00MB
    wpstg0_yikes_easy_mc_forms: Data: 0.02MB + Index: 0.00MB
    wpstg0_yoast_seo_links: Data: 0.02MB + Index: 0.02MB
    wpstg0_yoast_seo_meta: Data: 0.05MB + Index: 0.00MB
    wpstg0_yumpu_documents: Data: 0.02MB + Index: 0.00MB
    
    ### Post Type Counts ###
    
    3d-flip-book: 1
    attachment: 160
    cmreg_invitcode: 802
    cmreg_profile_field: 3
    easy-opt-ins: 1
    fl-builder-template: 17
    fl-theme-layout: 6
    ml-slide: 6
    ml-slider: 1
    nav_menu_item: 51
    page: 13
    pdf_lv: 1
    post: 2
    product: 8
    revision: 277
    shop_order: 756
    wafs: 2
    woocustomemails: 2
    wpcf7_contact_form: 1
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (40) ###
    
    Beaver Builder Plugin (Standard Version): by The Beaver Builder Team – 2.2.0.7
    Beaver Themer: by The Beaver Builder Team – 1.2.2.1
    Ultimate Addons for Beaver Builder: by Brainstorm Force – 1.14.4
    PowerPack for Beaver Builder: by IdeaBox Creations – 2.6.8.5
    CM Registration Bulk Invitation Addon: by CreativeMindsSolutions – 1.2.3
    CM Registration Pro: by CreativeMindsSolutions – 2.7.5
    Code Snippets: by Shea Bunge – 2.13.2
    Colorlib Login Customizer: by Colorlib – 1.2.7
    Contact Form 7 MailChimp Extension: by Renzo Johnson – 0.4.51
    Contact Form 7: by Takayuki Miyoshi – 5.1.1
    Custom Classes: by Justin Tadlock – 1.0.0
    Duplicate Page: by mndpsingh287 – 3.2
    Easy FancyBox: by RavanH – 1.8.13
    Flexible Shipping: by WP Desk – 3.1.6
    GP Premium: by Tom Usborne – 1.7.7
    Head & Footer Code: by Aleksandar Urosevic – 1.0.7
    Manage Notification E-mails: by Virgial Berveling – 1.4.1
    WooCommerce Przelewy24 Payment Gateway: by DialCom24 Sp. z o.o. – 1.0.0 – Not tested with the active version of WooCommerce
    reSmush.it Image Optimizer: by reSmush.it – 0.1.22
    Shortcode in Menus: by Gagan Deep Singh – 3.4
    Sticky Menu (or Anything!) on Scroll: by Mark Senff – 2.1.1
    Checkout Field Editor for WooCommerce: by ThemeHiGH – 1.3.1
    Woo Custom Emails Per Product: by Alex Mustin – 2.2.2
    Woo Custom Emails: by wp3sixty – 2.2 – Not tested with the active version of WooCommerce
    Advanced Order Export For WooCommerce: by AlgolPlus – 2.1.0
    WPC Product Bundles for WooCommerce: by WPclever.net – 3.4.1
    Woocommerce Add-to-Cart Custom Redirect: by Ren Ventura – 1.2.3 – Not tested with the active version of WooCommerce
    WooCommerce Advanced Free Shipping: by Jeroen Sormani – 1.1.3 – Not tested with the active version of WooCommerce
    WooCommerce Email Test: by RaiserWeb – 1.10 – Not tested with the active version of WooCommerce
    WooCommerce eNadawca Poczta Polska: by WP Desk – 1.5.17
    Booster for WooCommerce: by Algoritmika Ltd – 4.2.0
    WooCommerce Product Dependencies: by SomewhereWarm – 1.2.1 – Not tested with the active version of WooCommerce
    WooCommerce: by Automattic – 3.5.4
    WooCommerce iFirma: by WP Desk – 2.5.10
    Yoast SEO: by Team Yoast – 9.5
    WP Email Users: by techspawn1 – 1.6.6
    WP Media folder: by Joomunited – 4.7.5
    WP Security Audit Log: by WP White Security – 3.3.1.1
    WP Desk Helper: by WP Desk – 1.6.4
    Easy Forms for MailChimp: by YIKES
    Inc. – 6.5.0
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: PLN (zł)
    Currency Position: right_space
    Thousand Separator: 
    Decimal Separator: ,
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    woosb (woosb)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    ### WC Pages ###
    
    Shop base: ❌ Page not set
    Cart: #188 - /koszyk/
    Checkout: #189 - /zamowienie/
    My account: #190 - /moje-konto/
    Terms and conditions: ❌ Page not set
    
    ### Theme ###
    
    Name: GeneratePress Child
    Version: 0.1
    Author URL: http://www.imprero.com
    Child Theme: ✔
    Parent Theme Name: GeneratePress
    Parent Theme Version: 2.2.2
    Parent Theme Author URL: https://tomusborne.com
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: generatepress_child/woocommerce/emails/admin-cancelled-order.php
    generatepress_child/woocommerce/emails/admin-failed-order.php
    generatepress_child/woocommerce/emails/admin-new-order.php
    generatepress_child/woocommerce/emails/customer-completed-order.php
    generatepress_child/woocommerce/emails/customer-invoice.php
    generatepress_child/woocommerce/emails/customer-note.php version 2.5.0 is out of date. The core version is 3.5.0
    generatepress_child/woocommerce/emails/customer-on-hold-order.php version 2.5.0 is out of date. The core version is 3.5.0
    generatepress_child/woocommerce/emails/customer-processing-order.php version 2.5.0 is out of date. The core version is 3.5.4
    generatepress_child/woocommerce/emails/customer-refunded-order.php version 2.5.0 is out of date. The core version is 3.5.0
    generatepress_child/woocommerce/emails/customer-reset-password.php
    generatepress_child/woocommerce/emails/email-addresses.php version 2.4.0 is out of date. The core version is 3.5.4
    generatepress_child/woocommerce/emails/email-customer-details.php
    generatepress_child/woocommerce/emails/email-footer.php
    generatepress_child/woocommerce/emails/email-header.php
    generatepress_child/woocommerce/emails/email-order-details.php version 2.5.0 is out of date. The core version is 3.3.1
    generatepress_child/woocommerce/emails/email-order-items.php version 2.1.2 is out of date. The core version is 3.5.0
    generatepress_child/woocommerce/emails/email-styles.php version 2.3.0 is out of date. The core version is 3.3.0
    
    Outdated Templates: ❌
    
    • This reply was modified 5 years, 2 months ago by Jan Dembowski.
    • This reply was modified 5 years, 2 months ago by Jan Dembowski. Reason: Fixed formatting
    Plugin Support Ross V. a11n

    (@rossviviano)

    Automattic Happiness Engineer

    Hi @osiak,

    Thanks for your patience thus far.

    It looks like the next step would be to check for conflicts here.

    First, you’ll want to change the theme on your site to Storefront, then test. If that resolves the issue, you’ll want to get in touch with your theme’s developer and see if they have an update or fix for you. If changing the theme doesn’t help, you’ll want to deactivate all plugins except for WooCommerce and take a look. If that fixes the problem, re-enable the other plugins one by one to see where the issue is coming from. If you don’t want to test on your live site, then create a staging site using a plugin called WP Staging.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘When “Local Pickup” shipping option enabled I get a PHP error on checkout’ is closed to new replies.