co-cart / co-cart

πŸ›’ CoCart is a free REST API designed to decouple your slow WooCommerce storefront and convert it blazing-fast, build in any web framework, and save you countless hours.
https://cocartapi.com
Other
375 stars 64 forks source link

cocart_get_cart is deprecated #305

Closed boutzamat closed 2 years ago

boutzamat commented 2 years ago

Describe the bug

When fetching the cart via API (logged in user), WP generates an error in the error log: 2022/01/27 12:36:51 [error] 85459#85459: *4973 FastCGI sent in stderr: "PHP message: cocart_get_cart is deprecated since version 3.0.0 with no alternative available" while reading response header from upstream, client: 192.168.100.100, server: vuecommerce.lan, request: "GET /wp-json/cocart/v2/cart HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "vuecommerce.lan", referrer: "http://sometestsite.lan/"

Prerequisites

Steps to reproduce the issue

  1. Install CoCart lite + WC (latest version 6.1.1 as of right now)
  2. Make a request to the "get cart" endpoint: /wp-json/cocart/v2/cart
  3. Check the error log on the server

Expected/actual behaviour

The functionality actually works as intended, i experience no issues at all. The only real issue is that the error gets logged even if WP_DEBUG is set to false, which can lead to the log file growing too big in production.

Screenshots

Isolating the problem

WordPress Environment

``` ` ### WordPress Environment ### WordPress address (URL): http://vuecommerce.lan Site address (URL): http://vuecommerce.lan WC Version: 6.1.1 REST API Version: βœ” 6.1.1 WC Blocks Version: βœ” 6.5.2 Action Scheduler Version: βœ” 3.4.0 WC Admin Version: βœ” 3.0.3 Log Directory Writable: βœ” WP Version: 5.9 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: – Language: en_US External object cache: – ### Server Environment ### Server Info: nginx/1.14.2 PHP Version: 8.1.1 PHP Post Max Size: 8 MB PHP Time Limit: 30 PHP Max Input Vars: 1000 cURL Version: 7.64.0 OpenSSL/1.1.1d SUHOSIN Installed: – MySQL Version: 5.5.5-10.3.31-MariaDB-0+deb10u1 Max Upload Size: 2 MB Default Timezone is UTC: βœ” fsockopen/cURL: βœ” SoapClient: ❌ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected. DOMDocument: βœ” GZip: βœ” Multibyte String: βœ” Remote Post: βœ” Remote Get: βœ” ### Database ### WC Database Version: 6.1.1 WC Database Prefix: wp_ Total Database Size: 4.60MB Database Data Size: 3.12MB Database Index Size: 1.48MB wp_woocommerce_sessions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_cocart_carts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 2.03MB + Index: 0.06MB + Engine InnoDB wp_postmeta: Data: 0.13MB + Index: 0.06MB + Engine InnoDB wp_posts: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB ### Post Type Counts ### attachment: 23 customize_changeset: 1 nav_menu_item: 5 page: 7 post: 2 product: 18 product_variation: 7 revision: 2 shop_coupon: 1 shop_order: 1 ### Security ### Secure connection (HTTPS): ❌ Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates. Hide errors from visitors: βœ” ### Active Plugins (3) ### CoCart Lite: by SΓ©bastien Dumont – 3.0.17 What The File: by Never5 – 1.5.4 WooCommerce: by Automattic – 6.1.1 ### Inactive Plugins (0) ### ### Settings ### API Enabled: – Force SSL: – Currency: DKK (DKK) Currency Position: right_space 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: #6 - /shop/ Cart: #7 - /kurv/ Checkout: #8 - /kasse/ My account: #9 - /min-konto/ Terms and conditions: ❌ Page not set ### Theme ### Name: vuecommerce Version: 1.0.0 Author URL: https://boutzamat.dk Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: βœ” ### Templates ### Overrides: – ### Action Scheduler ### Complete: 29 Oldest: 2022-01-24 08:38:33 +0100 Newest: 2022-01-27 01:05:01 +0100 ### CoCart ### Version: 3.0.17 Database Version: 3.0.17 Install Date: 26. January 2022 Carts in Session: 1 Carts Active: 1 out of 1 in session. Carts Expiring Soon: 0 out of 1 in session. Carts Expired: 0 out of 1 in session. Carts Source (by CoCart): 0 Carts Source (by Web): 1 Carts Source (by Other): 0 ### Status report information ### Generated at: 2022-01-27 13:57:51 +01:00 ` ```

Additional context

seb86 commented 2 years ago

This PR seems to have fixed the issue according to @boutzamat

Closing issue.