Support » Plugin: WooCommerce » Cart is Empty

  • Resolved ila1351

    (@ila1351)


    I am having an issue where whenever someone adds a product to the cart, the page redirects to the cart and shows up as empty. If you wait a few seconds and refresh the page, then you can see the products in the cart. It may not be a caching issue or other issue stated in https://businessbloomer.com/woocommerce-solving-cart-empty-issue/.

    When I removed my Google Analytics tracking code, the cart then shows up with the added product normally. To be sure it was Google Analytics, I cleared the customer session data, cache, and cookies when testing. The moment I remove Google Analytics, the cart works fine. I have tried creating a new property with Google Analytics and using the new tracking code in the < head > of my site, but it still makes the cart show up as empty.

    Google Analytics Code

    
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-139568003-1"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-139568003-1');
    </script>
    

    WordPress System Status Report

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://ila1351.org
    Site address (URL): https://ila1351.org
    WC Version: 3.6.2
    Log Directory Writable: ✔
    WP Version: 5.1.1
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: 7.2.15
    PHP Post Max Size: 100 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 1000
    cURL Version: 7.45.0
    OpenSSL/1.0.1e
    
    SUHOSIN Installed: –
    MySQL Version: 5.6.32-78.0-log
    Max Upload Size: 100 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 3.6.2
    WC Database Prefix: wp_
    MaxMind GeoIP Database: ✔
    Total Database Size: 15.13MB
    Database Data Size: 13.02MB
    Database Index Size: 2.11MB
    wp_woocommerce_sessions: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_order_items: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_order_itemmeta: Data: 0.01MB + Index: 0.02MB
    wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB
    wp_ai1ec_events: Data: 0.01MB + Index: 0.01MB
    wp_ai1ec_event_category_meta: Data: 0.00MB + Index: 0.00MB
    wp_ai1ec_event_instances: Data: 0.00MB + Index: 0.00MB
    wp_commentmeta: Data: 0.00MB + Index: 0.00MB
    wp_comments: Data: 0.01MB + Index: 0.02MB
    wp_edn_subscriber: Data: 0.00MB + Index: 0.00MB
    wp_hsa_plugin: Data: 0.00MB + Index: 0.00MB
    wp_links: Data: 0.00MB + Index: 0.00MB
    wp_options: Data: 1.03MB + Index: 0.06MB
    wp_postmeta: Data: 0.46MB + Index: 0.18MB
    wp_posts: Data: 3.96MB + Index: 0.12MB
    wp_swpm_membership_meta_tbl: Data: 0.00MB + Index: 0.00MB
    wp_swpm_membership_tbl: Data: 0.00MB + Index: 0.00MB
    wp_swpm_members_tbl: Data: 0.03MB + Index: 0.00MB
    wp_swpm_payments_tbl: Data: 0.00MB + Index: 0.00MB
    wp_termmeta: Data: 0.00MB + Index: 0.01MB
    wp_terms: Data: 0.00MB + Index: 0.01MB
    wp_term_relationships: Data: 0.00MB + Index: 0.01MB
    wp_term_taxonomy: Data: 0.00MB + Index: 0.00MB
    wp_usermeta: Data: 0.22MB + Index: 0.14MB
    wp_users: Data: 0.02MB + Index: 0.03MB
    wp_wc_download_log: Data: 0.00MB + Index: 0.00MB
    wp_wc_product_meta_lookup: Data: 0.00MB + Index: 0.01MB
    wp_wc_webhooks: Data: 0.00MB + Index: 0.00MB
    wp_wfBadLeechers: Data: 0.00MB + Index: 0.00MB
    wp_wfBlockedCommentLog: Data: 0.00MB + Index: 0.00MB
    wp_wfBlockedIPLog: Data: 0.00MB + Index: 0.00MB
    wp_wfBlocks7: Data: 0.00MB + Index: 0.00MB
    wp_wfConfig: Data: 1.40MB + Index: 0.02MB
    wp_wfCrawlers: Data: 0.00MB + Index: 0.00MB
    wp_wfFileChanges: Data: 0.00MB + Index: 0.00MB
    wp_wfFileMods: Data: 1.48MB + Index: 0.32MB
    wp_wfHits: Data: 3.16MB + Index: 0.80MB
    wp_wfHoover: Data: 0.00MB + Index: 0.00MB
    wp_wfIssues: Data: 0.01MB + Index: 0.01MB
    wp_wfKnownFileList: Data: 0.75MB + Index: 0.10MB
    wp_wfLeechers: Data: 0.02MB + Index: 0.02MB
    wp_wfLiveTrafficHuman: Data: 0.01MB + Index: 0.01MB
    wp_wfLocs: Data: 0.01MB + Index: 0.00MB
    wp_wfLogins: Data: 0.15MB + Index: 0.04MB
    wp_wfNotifications: Data: 0.00MB + Index: 0.00MB
    wp_wfPendingIssues: Data: 0.00MB + Index: 0.00MB
    wp_wfReverseCache: Data: 0.00MB + Index: 0.00MB
    wp_wfScanners: Data: 0.01MB + Index: 0.01MB
    wp_wfSNIPCache: Data: 0.00MB + Index: 0.00MB
    wp_wfStatus: Data: 0.19MB + Index: 0.07MB
    wp_wfTrafficRates: Data: 0.00MB + Index: 0.00MB
    wp_wfVulnScanners: Data: 0.00MB + Index: 0.00MB
    wp_xm41b6scsm_commentmeta: Data: 0.00MB + Index: 0.00MB
    wp_xm41b6scsm_comments: Data: 0.00MB + Index: 0.01MB
    wp_xm41b6scsm_links: Data: 0.00MB + Index: 0.00MB
    wp_xm41b6scsm_options: Data: 0.05MB + Index: 0.02MB
    wp_xm41b6scsm_postmeta: Data: 0.00MB + Index: 0.01MB
    wp_xm41b6scsm_posts: Data: 0.00MB + Index: 0.01MB
    wp_xm41b6scsm_termmeta: Data: 0.00MB + Index: 0.00MB
    wp_xm41b6scsm_terms: Data: 0.00MB + Index: 0.01MB
    wp_xm41b6scsm_term_relationships: Data: 0.00MB + Index: 0.00MB
    wp_xm41b6scsm_term_taxonomy: Data: 0.00MB + Index: 0.00MB
    wp_xm41b6scsm_usermeta: Data: 0.00MB + Index: 0.01MB
    wp_xm41b6scsm_users: Data: 0.00MB + Index: 0.01MB
    wp_yoast_seo_links: Data: 0.03MB + Index: 0.01MB
    wp_yoast_seo_meta: Data: 0.00MB + Index: 0.00MB
    
    ### Post Type Counts ###
    
    ai1ec_event: 39
    attachment: 89
    custom_css: 2
    et_pb_layout: 5
    flamingo_contact: 229
    flamingo_inbound: 85
    nav_menu_item: 9
    page: 20
    popup: 1
    popup_theme: 6
    post: 1
    product: 6
    project: 1
    revision: 484
    scheduled-action: 8
    shop_order: 37
    wpcf7_contact_form: 1
    wp_block: 1
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (17) ###
    
    All-in-One Event Calendar by Time.ly: by Time.ly Network Inc. – 2.5.39
    Contact Form 7: by Takayuki Miyoshi – 5.1.1
    WooCommerce Continue Shopping: by HappyKite – 1.3.1 – Not tested with the active version of WooCommerce
    Cookie Notice: by dFactory – 1.2.46
    Flamingo: by Takayuki Miyoshi – 1.9
    Horizontal scrolling announcement: by Gopi Ramasamy
    juliencayzac – 9.2
    
    Nav Menu Roles: by Kathy Darling – 1.9.3
    Popup Maker: by WP Popup Maker – 1.8.5
    Simple WordPress Membership: by smp7
    wp.insider – 3.7.9
    
    Simple Membership Google recaptcha: by smp7
    wp.insider – v1.9
    
    UpdraftPlus - Backup/Restore: by UpdraftPlus.Com
    DavidAnderson – 1.16.14
    
    WooCommerce Square: by WooCommerce – 1.0.37
    WooCommerce: by Automattic – 3.6.2
    Wordfence Security: by Wordfence – 7.2.5
    Yoast SEO: by Team Yoast – 11.0 – Not tested with the active version of WooCommerce
    WP-Matomo: by André Bräkling – 1.0.21
    WPS Hide Login: by WPServeur
    NicolasKulka
    tabrisrp – 1.5.2.1
    
    ### Inactive Plugins (0) ###
    
    ### Dropin Plugins (1) ###
    
    object-cache.php: APCu Object Cache
    
    ### Must Use Plugins (1) ###
    
    System Plugin: by  – 3.9.5
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: USD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    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)
    
    Connected to WooCommerce.com: ✔
    
    ### WC Pages ###
    
    Shop base: #934 - /payments/
    Cart: #956 - /cart/
    Checkout: #957 - /checkout/
    My account: #958 - /my-account/
    Terms and conditions: ❌ Page not set
    
    ### Theme ###
    
    Name: Divi Child Theme - By Boral Agency
    Version: 1.0.0
    Author URL: https://www.boralagency.com/
    Child Theme: ✔
    Parent Theme Name: Divi
    Parent Theme Version: 3.22.4
    Parent Theme Author URL: http://www.elegantthemes.com
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: –
    
    ### Action Scheduler ###
    
    Complete: 7
    Oldest: 2019-04-17 12:06:16 -0500
    Newest: 2019-05-03 13:14:10 -0500
    
    Pending: 1
    Oldest: 2019-05-08 13:35:22 -0500
    Newest: 2019-05-08 13:35:22 -0500
    
    Canceled: 0
    Oldest: –
    Newest: –
    
    In-progress: 0
    Oldest: –
    Newest: –
    
    Failed: 0
    Oldest: –
    Newest: –
    
    

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Stef

    (@serafinnyc)

    You are better off using Google Tag Manager to limit the amount of conflicts. I’m not saying that’s the solution, but in my experience you will find that you have less jQuery issues.

    I see multiple errors in console.

    ila1351

    (@ila1351)

    So I tried using Google Tag Manager, and the cart page doesn’t show up as empty any more. Your solution worked however, it only worked for desktop. For some reason only on mobile, the cart shows up as empty. When I remove Google Tag Manager, the cart doesn’t show as empty.

    Stef

    (@serafinnyc)

    Could be the way your adding the scripts. I didn’t see the inside body script. Only the head script. Did you not add that? I’m not saying that’s the cause but it’s possible.

    Stef

    (@serafinnyc)

    You have multiple tracking scripts going on. Something is definitely conflicting there and I reviewed GTM and I don’t see the second script which needs to be added after the body.

    See if this article helps you.
    https://www.optimizesmart.com/google-tag-manager-wordpress-installation-guide/

    There has to be another reason also as to why the product is not being added to the cart. Ajax most likely something is broken there.

    ila1351

    (@ila1351)

    Are you sure you don’t see the second script? I checked on my browser’s inspector and see it under PIWIK’s script. Also, I checked the Google Tag Manager’s preview/debugger. It works and shows that the Google Analytics tag is firing for both desktop and mobile.

    Stef

    (@serafinnyc)

    If it’s not right after the body tag it’s not where it needs to be. I’ll check again.

    Stef

    (@serafinnyc)

    It’s there but it’s at the bottom, it needs to be right after the opening body tag.

    This PIWIK is conflicting with Google Analytics for sure.

    Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey there @ila1351

    As your query is related to something out with the core WooCommerce plugin, I’m going to mark this as resolved – please reach out to us via your WooCommerce.com account.

    There are a range of plugins to integrate Google Analytics with WooCommerce and WordPress – there is the https://woocommerce.com/products/woocommerce-google-analytics/ plugin

    If you have any further questions about WooCommerce core, you can start a new thread.

    Thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.