co-cart / co-cart

🛒 CoCart makes it easy to decouple your WooCommerce store via a customizable REST API that takes the pain out of developing – allowing you to build fast and flexible headless stores.

Home Page:https://cocartapi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility: Invalid Data Store when accessing WP dashboard as a vendor (user role) with WooCommerce - WC Marketplace plugin active.

luco opened this issue · comments

Describe the bug

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of CoCart on GitHub (this is not the same version as on WordPress.org!)
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have installed the requirements to run this plugin.
  • I have included a failing test as a pull request (Optional)

Steps to reproduce the issue

  1. Activate CoCart
  2. Try to use Ajax or Access wp-admin when not a admin user

Expected/actual behaviour

When I activate the CoCart it creates a Invalid Data Store error.

Screenshots

Captura de Tela 2022-02-24 às 14 01 59

Isolating the problem

  • This bug happens with only WooCommerce and CoCart plugin are active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the WordPress theme Storefront active.
  • This bug happens with the latest release of WooCommerce active.
  • This bug happens only when I authenticate as a customer.
  • This bug happens only when I authenticate as administrator.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

` ### WordPress Environment ###

WordPress address (URL): http://localhost/maddies/shop
Site address (URL): http://localhost/maddies/shop
WC Version: 5.4.2
REST API Version: ✔ 5.4.2
WC Blocks Version: ✔ 5.1.0
Action Scheduler Version: ✔ 3.1.6
WC Admin Version: ✔ 2.3.1
Log Directory Writable: ✔
WP Version: 5.9.1
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_US
External object cache: –

Server Environment

Server Info: Apache/2.4.46 (Unix) PHP/7.3.33
PHP Version: 7.3.33
PHP Post Max Size: 48 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.80.0
(SecureTransport) OpenSSL/1.1.1m

SUHOSIN Installed: –
MySQL Version: 8.0.22
Max Upload Size: 48 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 5.4.2
WC Database Prefix: wp_
Total Database Size: 50.54MB
Database Data Size: 33.45MB
Database Index Size: 17.09MB
wp_woocommerce_sessions: Data: 0.02MB + 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.06MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.30MB + Index: 0.28MB + 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.13MB + Index: 0.02MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.08MB + Index: 0.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_options: Data: 2.05MB + Index: 0.14MB + Engine InnoDB
wp_postmeta: Data: 23.47MB + Index: 11.77MB + Engine InnoDB
wp_posts: Data: 5.44MB + Index: 2.78MB + Engine InnoDB
wp_product_claims: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_term_relationships: Data: 0.47MB + Index: 0.16MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_termmeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + 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.39MB + Index: 0.69MB + 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
wp_wcmp_cust_answers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wcmp_cust_questions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wcmp_products_map: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wcmp_shipping_zone_locations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wcmp_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wcmp_vendor_ledger: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
wp_wcmp_vendor_orders: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wcmp_visitors_stats: Data: 0.02MB + Index: 0.09MB + Engine InnoDB

Post Type Counts

acf-field: 105
acf-field-group: 12
artist-product: 2
attachment: 5550
collections-owners: 1
coupon-claim: 2
dc_commission: 2
ep-synonym: 1
nav_menu_item: 48
official-shop: 3
page: 14
post: 2
product: 657
product_variation: 3250
revision: 45
shop_coupon: 2
shop_order: 198
wpcf7_contact_form: 1

Security

Secure connection (HTTPS): ❌
Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: ✔

Active Plugins (12)

ACF Field For Contact Form 7: by KrishaWeb – 1.6
Advanced Custom Fields: Repeater Field: by Elliot Condon – 2.1.0
Advanced Custom Fields: by Delicious Brains – 5.9.9
CoCart Lite: by Sébastien Dumont – 3.0.17
Contact Form 7: by Takayuki Miyoshi – 5.4.2
Multivendor Marketplace Solution for WooCommerce - WC Marketplace: by WC Marketplace – 3.8.4
Easy WP SMTP: by wpecommerce
alexanderfoxc – 1.4.7

Maddie's Algolia Integration: by – 1.0.0
Maddie's ERC20 Gateway: by – 1.0.0
Rally Payment Gateway: by Maddie's – 1.0
Maddie's Custom Printify Shipping Method: by Maddie's – 2.5
WooCommerce: by Automattic – 5.4.2 (update to version 6.2.1 is available)

Inactive Plugins (5)

Coinbase Commerce: by Coinbase Commerce – 1.1.4
Duplicate Page: by mndpsingh287 – 4.4.5
Gooten Shipping Handler: by Maddie's – 1.0
Maddie's Algolia Integration: by – 1.0.0
Query Monitor: by John Blackbourn – 3.7.1

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: #5 - /shop/
Cart: #6 - /cart/
Checkout: #7 - /checkout/
My account: #8 - /my-account/
Terms and conditions: ❌ Page not set

Theme

Name: Maddie's
Version: 1.0
Author URL: https://maddies.co
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: .DS_Store
maddies/woocommerce/archive-product.php
maddies/woocommerce/cart/cart-empty.php
maddies/woocommerce/cart/mini-cart.php
maddies/woocommerce/content-product.php
maddies/woocommerce/content-single-product.php
maddies/woocommerce/global/quantity-input.php
maddies/woocommerce/myaccount/dashboard.php version - is out of date. The core version is 4.4.0
maddies/woocommerce/myaccount/form-edit-account.php
maddies/woocommerce/myaccount/orders.php
maddies/woocommerce/myaccount/view-order.php
maddies/woocommerce/order/order-details.php
maddies/woocommerce/order/tracking.php
maddies/woocommerce/single-product.php

Outdated Templates: ❌

					Learn how to update

Action Scheduler

Complete: 18
Oldest: 2022-01-29 17:42:05 +0000
Newest: 2022-02-24 02:48:02 +0000

CoCart

Version: 3.0.17
Database Version: 3.0.17
Install Date: February 20
2022

Carts in Session: 3
Carts Active: 3 out of 3 in session.
Carts Expiring Soon: 0 out of 3 in session.
Carts Expired: 0 out of 3 in session.
Carts Source (by CoCart): 0
Carts Source (by Web): 1
Carts Source (by Other): 2

Status report information

Generated at: 2022-02-24 17:21:18 +00:00
`

Additional context

@luco You have not provided your WordPress environment as requested in the template. Please edit your original posting and add it.

Go to "WooCommerce > System Status then copy and paste the system status report please. Thank you.

Thank you. I wouldn't have known the WC version you see. Kind of important.

It's happening on production as well. Only if the plugin is active and the logged user tries to use the ajax/wp-admin

Could you provide actual steps to reproduce as CoCart doesn't do any AJAX.

I know, what I mean is that I only discovered this error when doing ajax (which goes to wp-admin/admin-ajax.php).

Just go to admin-ajax.php without any parameters?

No. Sorry for the confusion. When a user (not admin) is logged, the wp-admin throws this error.

And what user roles do you have?

Many, but in this case is the Vendor role which is not allowed to access admin. But instead of giving the Permission denied screen it returns this error.

So compatibility with Multivendor Marketplace Solution for WooCommerce - WC Marketplace is the issue. OK. I will look into it. Thank you for reporting the issue.

@seb86 Any updates on this?

Not yet I'm afraid @luco Has the WC Marketplace plugin developers said anything?

@luco I'm experimenting with a filter that prevents any WC admin notes by CoCart to be disabled, but after reviewing WC Admin and my code, it looks more of a compatibility issue on their end when it comes to vendor user roles.

I have yet to see the source code but the plugin may be doing something hacky that stops a required class to load in the backend.

I don't have a marketplace demo site to test extensively on but that's my guess.

OK, I think the issue was a priority order issue because now that I have updated my WC Admin notes and deprecated support for older versions, I seem to be able to access the WP Dashboard as a vendor. You will have to download the trunk branch and test it for me but I think it should be fine now.

Cool, I'll give it a shot and let you know. Thanks for the support! Also, thanks for the amazing plugin!

Closing issue for now.

Worked! But now I found another bug: #324

Thanks