Items not showing in the cart
-
I have added item in the cart and it had returned both the cart_hash and cart_key
But when i get the cart with cart_key, there are no items in the cart but it shows the customer information
Need urgent help in this matter
-
Can you share your WooCommerce System Status info “unedited”?
I think you are talking about this
` WordPress Environment</p> <p>WordPress address (URL): https://greyguminternationalcafe.com.au<br>Site address (URL): https://greyguminternationalcafe.com.au<br>WC Version: 9.1.4<br>Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site.<br>Action Scheduler Version: ? 3.7.4<br>Log Directory Writable: ?<br>WP Version: 6.6.1<br>WP Multisite: –<br>WP Memory Limit: 2 GB<br>WP Debug Mode: –<br>WP Cron: ?<br>Language: en_US<br>External object cache: – Server Environment</p> <p>Server Info: LiteSpeed<br>PHP Version: 8.2.15<br>PHP Post Max Size: 2 GB<br>PHP Time Limit: 360<br>PHP Max Input Vars: 5000<br>cURL Version: 7.87.0<br>OpenSSL/1.1.1w</p> <p>SUHOSIN Installed: –<br>MySQL Version: 10.11.8-MariaDB-cll-lve<br>Max Upload Size: 2 GB<br>Default Timezone is UTC: ?<br>fsockopen/cURL: ?<br>SoapClient: ?<br>DOMDocument: ?<br>GZip: ?<br>Multibyte String: ?<br>Remote Post: ?<br>Remote Get: ? Database</p> <p>WC Database Version: 9.1.4<br>WC Database Prefix: wp_<br>Total Database Size: 19.57MB<br>Database Data Size: 16.43MB<br>Database Index Size: 3.14MB<br>wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_actions: Data: 0.09MB + Index: 0.11MB + Engine InnoDB<br>wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_logs: Data: 0.09MB + Index: 0.03MB + Engine InnoDB<br>wp_bwg_album: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_album_gallery: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_file_paths: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_gallery: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_image: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_image_comment: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_image_rate: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_image_tag: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_shortcode: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_bwg_theme: Data: 0.08MB + Index: 0.00MB + Engine InnoDB<br>wp_cocart_carts: Data: 0.09MB + Index: 0.02MB + Engine InnoDB<br>wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB<br>wp_e_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_gla_attribute_mapping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_gla_budget_recommendations: Data: 0.19MB + Index: 0.14MB + Engine InnoDB<br>wp_gla_merchant_issues: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_gla_shipping_rates: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_gla_shipping_times: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_jetpack_sync_queue: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_litespeed_img_optming: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_litespeed_url: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_litespeed_url_file: Data: 0.02MB + Index: 0.08MB + Engine InnoDB<br>wp_options: Data: 5.27MB + Index: 0.16MB + Engine InnoDB<br>wp_postmeta: Data: 4.52MB + Index: 0.59MB + Engine InnoDB<br>wp_posts: Data: 4.52MB + Index: 0.19MB + Engine InnoDB<br>wp_tec_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_tec_occurrences: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_termmeta: Data: 0.08MB + Index: 0.09MB + Engine InnoDB<br>wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_term_relationships: Data: 0.06MB + Index: 0.02MB + Engine InnoDB<br>wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_usermeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB<br>wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_orders: Data: 0.02MB + Index: 0.13MB + Engine InnoDB<br>wp_wc_orders_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_operational_data: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_product_attributes_lookup: Data: 0.06MB + Index: 0.05MB + Engine InnoDB<br>wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.11MB + Engine InnoDB<br>wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wpmm_subscribers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB Post Type Counts</p> <p>attachment: 283<br>bwg_album: 1<br>bwg_share: 1<br>elementor_library: 2<br>nav_menu_item: 27<br>page: 22<br>post: 9<br>product: 57<br>product_variation: 115<br>revision: 232<br>rey-global-sections: 7<br>shop_order: 1<br>tribe_events: 3<br>tribe_organizer: 2<br>tribe_venue: 1<br>wp_navigation: 1 Security</p> <p>Secure connection (HTTPS): ?<br>Hide errors from visitors: ? Active Plugins (14)</p> <p>Afterpay Gateway for WooCommerce: by Afterpay – 3.8.6<br>All-in-One WP Migration: by ServMask – 7.84<br>CoCart API – Decoupling Made Easy for WooCommerce: by CoCart Headless<br>LLC – 4.3.3</p> <p>CoCart CORS Support: by CoCart Headless<br>LLC – 1.0.7</p> <p>Elementor: by Elementor.com – 3.23.3<br>Google for WooCommerce: by WooCommerce – 2.8.0<br>LiteSpeed Cache: by LiteSpeed Technologies – 6.3.0.1<br>Otter – Page Builder Blocks & Extensions for Gutenberg: by ThemeIsle – 2.6.13<br>Photo Gallery: by Photo Gallery Team – 1.8.27<br>Rey Core: by ReyTheme – 3.0.0<br>The Events Calendar: by The Events Calendar – 6.6.0.2<br>WooPayments: by WooCommerce – 8.0.1<br>WooCommerce: by Automattic – 9.1.4<br>LightStart – Maintenance Mode, Coming Soon and Landing Page Builder: by Themeisle – 2.6.11 Inactive Plugins (1)</p> <p>Hostinger Tools: by Hostinger – 3.0.6 Settings</p> <p>API Enabled: –<br>Force SSL: –<br>Currency: AUD ($)<br>Currency Position: left<br>Thousand Separator: ,<br>Decimal Separator: .<br>Number of Decimals: 0<br>Taxonomies: Product Types: external (external)<br>grouped (grouped)<br>simple (simple)<br>variable (variable)</p> <p>Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)<br>exclude-from-search (exclude-from-search)<br>featured (featured)<br>outofstock (outofstock)<br>rated-1 (rated-1)<br>rated-2 (rated-2)<br>rated-3 (rated-3)<br>rated-4 (rated-4)<br>rated-5 (rated-5)</p> <p>Connected to WooCommerce.com: ?<br>Enforce Approved Product Download Directories: ?<br>HPOS feature enabled: –<br>Order datastore: WC_Order_Data_Store_CPT<br>HPOS data sync enabled: – Logging</p> <p>Enabled: ?<br>Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2<br>Retention period: 30 days<br>Level threshold: –<br>Log directory size: 182 KB WC Pages</p> <p>Shop base: #164 – /shop-2/<br>Cart: #9 – /cart/ – Contains the [woocommerce_cart] shortcode<br>Checkout: #10 – /checkout/ – Contains the [woocommerce_checkout] shortcode<br>My account: #11 – /my-account/<br>Terms and conditions: ? Page not set Theme</p> <p>Name: Rey Child<br>Version: 1.0.0<br>Author URL: https://twitter.com/mariushoria<br>Child Theme: ?<br>Parent Theme Name: Rey<br>Parent Theme Version: 3.0.0<br>Parent Theme Author URL: https://twitter.com/mariushoria<br>WooCommerce Support: ? Templates</p> <p>Overrides: /home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/cart/cart-item-data.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/cart/mini-cart.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/loop-orderby.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/loop-pagination-paged.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/loop-price.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/loop-result-count.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/header-account-menu.php version – is out of date. The core version is 9.0.0<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/single-simple-add-to-cart-button.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/single-variation-add-to-cart-button.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/single-variation-data.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/single-meta.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/single-product-attributes.php<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/single-product-image.php version 7.8.0 is out of date. The core version is 9.0.0<br>/home/u504797127/domains/greyguminternationalcafe.com.au/public_html/wp-content/plugins/rey-core/template-parts/woocommerce/single-blocks.php</p> <p>Outdated Templates: ?</p> <pre class=”wp-block-code”><code> Learn how to update</code></pre> <p>WooPayments</p> <p>Version: 8.0.1<br>Connected to WPCOM: Yes<br>WPCOM Blog ID: 225085142<br>Account ID: acct_1O51S2Fs6nupXWr8<br>Payment Gateway: Enabled<br>Test Mode: Disabled<br>Enabled APMs: card<br>WooPay: Not eligible<br>Apple Pay / Google Pay: Enabled (product,cart,checkout)<br>Fraud Protection Level: basic<br>Multi-currency: Enabled<br>Auth and Capture: Enabled<br>Documents: Disabled<br>Logging: Disabled Admin</p> <p>Enabled Features: activity-panels<br>analytics<br>product-block-editor<br>coupons<br>core-profiler<br>customize-store<br>customer-effort-score-tracks<br>import-products-task<br>experimental-fashion-sample-products<br>shipping-smart-defaults<br>shipping-setting-tour<br>homescreen<br>marketing<br>mobile-app-banner<br>navigation<br>onboarding<br>onboarding-tasks<br>product-custom-fields<br>remote-inbox-notifications<br>remote-free-extensions<br>payment-gateway-suggestions<br>shipping-label-banner<br>subscriptions<br>store-alerts<br>transient-notices<br>woo-mobile-welcome<br>wc-pay-promotion<br>wc-pay-welcome-page<br>launch-your-store</p> <p>Disabled Features: experimental-blocks<br>minified-js<br>pattern-toolkit-full-composability<br>product-pre-publish-modal<br>printful<br>settings<br>async-product-editor-category-field<br>product-editor-template-system</p> <p>Daily Cron: ? Next scheduled: 2024-08-02 13:36:35 +05:00<br>Options: ?<br>Notes: 111<br>Onboarding: completed Action Scheduler</p> <p>Complete: 143<br>Oldest: 2024-07-02 06:11:56 +0000<br>Newest: 2024-08-01 23:08:38 +0000</p> <p>Failed: 58<br>Oldest: 2023-08-31 07:42:34 +0000<br>Newest: 2024-08-01 21:24:46 +0000</p> <p>Pending: 4<br>Oldest: 2024-08-02 21:24:46 +0000<br>Newest: 2024-08-08 12:28:07 +0000 CoCart</p> <p>Version: 4.3.3<br>Database Version: 4.3.3<br>Install Date: November 1<br>2023</p> <p>Cart Sessions:<br>Carts in Session: 27<br>Carts Active: 27 out of 27 in session.<br>Carts Expiring Soon: 1 out of 27 in session.<br>Carts Expired: 0 out of 27 in session.<br>Carts Created (by CoCart): 19<br>Carts Created (by Web): 8<br>Carts Created (by Other): 0 Status report information</p> <p>Generated at: 2024-08-02 05:23:22 +05:00<br>`
Using Postman with no authentication, I was able to add a product to the cart and got the cart response providing me the cart key and the item I just added in the cart. I then did a request to get the cart again using the cart key and it returned the same results.
Where you only making requests with no authentication?
First I was doing it with basic auth
Then I did it with no auth
In both cases add-item added the product and returned the cart_key
But when getting cart using ( wp-json/cocart/v2/cart ) it returns“items”: [],
“item_count”: 0,
“items_weight”: “0”,
Further more it’s a variable product that I am adding to the cart
like this“variation”: {
“attribute_pa_color”: “black”,
“attribute_pa_sizes”: “M”
}
When authenticated you don’t use the cart key as the session already knows which cart to load based on the user you connected with. However, if you started as a guest and then authenticated, then only one time, would you need to use the cart key in order to migrate the cart contents to the authenticated user.
Can you see if you get 1 item in this guest cart on your end?
curl --location --request GET 'https://greyguminternationalcafe.com.au/wp-json/cocart/v2/cart?cart_key=75c5d5e3102496bb0d5d94e45325f5'Yes, this curl worked fine
can you please explain what I did wrong, it would be helpfulWould you be able to replicate what you did in a video? That way I can see what steps you did.
I can’t, as it was working fine few days back and then suddenly I started getting issues
As these API’s are connected to a mobile appIt stoped working on mobile side and on postman as well
This may be due to the auth as you have mentioned above, I may have to check my mobile side code as well
For now I am making this as resolved and will reopen it if got any issues
Thanks for the quick help
Best Regards
- You must be logged in to reply to this topic.