Git Product home page Git Product logo

co-cart / co-cart Goto Github PK

View Code? Open in Web Editor NEW
355.0 13.0 64.0 8.43 MB

🛒 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

License: Other

JavaScript 34.63% Shell 65.37%
woocommerce woocommerce-extension feature-plugin wordpress-plugin rest-api cart woocommerce-api api wordpress wordpress-development

co-cart's Introduction

CoCart. Build headless stores, without building an API

Licence Latest Stable Version WordPress Plugin Downloads

❗ This branch is the current stable version of CoCart. If you are looking to contribute to CoCart, please use the "dev" branch.

Welcome to the CoCart repository on GitHub. Here you can browse the source, look at open issues and keep track of development. We recommend all developers to follow the CoCart development blog to stay up to date about everything happening in the project. You can also follow @cocartapi on Twitter for the latest development updates.

If you are looking for documentation, head over here: https://docs.cocart.xyz

Click here to download the latest release package of CoCart Core.

Supercharge your WooCommerce store by going headless

Is your store slow? Looking to decouple away from WordPress? With CoCart's customizable REST API for WooCommerce, you can make your store headless in days, not months, using the frameworks and tools you love. Unlock your stores potential for an extraordinary online shopping experience.

What is WooCommerce?

WooCommerce is a flexible, open-source commerce solution built on WordPress, empowering anyone to sell anything, anywhere and is the fastest-growing eCommerce platform on the internet.

Why CoCart?

Are you agonizing trying to develop your own REST API for WooCommerce? With CoCart, it's ready to use, customizable to your needs and more importantly, it saves you development time. Once installed, your WooCommerce store is ready to decouple away from WordPress, allowing you to design without limitations imposed by a WordPress theme that is harder to modify and optimize. Utilize faster, familiar frameworks you know and love—it's that simple.

✨ What do you get with the core of CoCart?

Everything you need to try and see if making your store headless is right for you. Promise you wont be disappointed.

  • No Blocks - The API is designed for the purpose of decoupling. Not blocks for Gutenberg.
  • Enhanced Session Handler - Our session handler adds support to allow our API the power it requires for any decoupled situation.
  • Basic Authentication - No Admin API Keys required. Customers have full control, either as a guest or authenticated with their login details.
  • Domain dominance - CORS can be an issue when decoupling. Don’t sweat the small stuff. We got you.
  • No Headless Checkout? - Load any cart session via the native site, if you feel more comfortable using WooCommerce’s built in payment system.
  • Worried about Caching? - The Cart API does not cache no matter what cache system you have installed for other API’s in use. Responses return fresh every time.
  • Reduced Cart Checkups - Avoid the hassle of multiple requests to verify item and coupon validity in your cart. Our system efficiently checks stock, validates coupons, and calculates totals and fees, ensuring real-time accuracy before confirmation.
  • Need your own cart callback? - Register custom callbacks without needing to create a whole new endpoint. Cart response returns once the callback is completed.
  • Your Inventory - Search by Name, ID or SKU, filter and return product data you need without authentication. REST shortcuts are readily provided for your next requests.
  • Want to track your customers? - Keep watch of all cart sessions, even the ones that are starting to expire.
  • Name Your Price Built In - Give your customers control of the price they pay. Encourage your audience to support you with payment flexibility that widens your paying audience.

And this is just the tip of the iceberg.

📦 Serious about going headless?

Try out more features and unlock your stores potential. Upgrade to complete the API with additional features that help make your store more awesome.

See what we have in store.

👍 Add-ons to further enhance CoCart

We also have add-ons that extend CoCart to enhance your development and your customers shopping experience.

They work with the core of CoCart already, and these add-ons of course come with support too.

🧰 Developer Tools

  • CoCart Beta Tester allows you to test with bleeding edge versions of CoCart from the GitHub repo.
  • CoCart VSCode extension for Visual Studio Code adds snippets and autocompletion of functions, classes and hooks.
  • CoCart Carts in Session allows you to view all the carts in session via the WordPress admin.
  • CoCart Product Support Boilerplate provides a basic boilerplate for supporting a different product type to add to the cart with validation including adding your own parameters.
  • CoCart Cart Callback Example provides you an example of registering a callback that can be triggered when updating the cart.

Need Support?

CoCart is not supported via the WooCommerce help desk as the plugin is not sold via Woo.com, the support team at Woo.com is not familiar with it and may not be able to assist.

We aim to provide regular support for the CoCart plugin on the WordPress.org forums. But please understand that we do prioritize support for our paying customers. Support can also be requested with the community on Discord.

🐞 Bug Reporting

Bug reports for CoCart are welcomed in the CoCart repository on GitHub. Please note that GitHub is not a support forum, and that issues that aren’t properly qualified as bugs will be closed.

Support CoCart

Please consider starring ✨ and sharing 👍 the project repo! This helps the project get known and grow with the community. 🙏

Thank you for your support! 🙌

Testimonials

An excellent plugin, which makes building a headless WooCommerce experience a breeze. Easy to use, nearly zero setup time.

Harald Schneider ⭐️⭐️⭐️⭐️⭐️

What can I say this thing has it all. It is the “Missing WooCommerce REST API plugin” without it I was managing users cart myself in weird and wonderful but hacky ways. NOT GOOD and so vulnerable. Then I stumbled upon CoCart and with the help of Seb I got it working how I needed it and he has been supporting me with even the smallest of queries. Really appreciate your work and continued support Seb.

Joel Pierre – JPPdesigns Web design & Development ⭐️⭐️⭐️⭐️⭐️

This plugin was critical to achieve my project of building a headless / decoupled WooCommerce store. I wanted to provide my clients with a CMS to manage their store, but wanted to build the front-end in React. I was able to fetch content over the WooCommerce REST API, but otherwise would not have been able to fetch the cart, and add & remove items if not for this plugin.

Thank you very much Sébastien for sharing this extension, you’ve saved me a lot of time.

Allan Pooley – Little and Big ⭐️⭐️⭐️⭐️⭐️

Thanks for doing such a great work with this! Works exactly as expected and CoCart seems to have a nice community around it. The founder seems really devoted and that’s one of the key things for a plugin like this to live on and get the right updates in the future. We just got ourselves the lifetime subscription.

MightyGroup – Rikard Kling ⭐️⭐️⭐️⭐️⭐️

See the wall of love for more testimonials.


CoCart Channels

We have different channels at your disposal where you can find information about the CoCart project, discuss it and get involved:

Twitter: cocartapi CoCart Github Stars

  • 📖 Docs: this is the place to learn how to use CoCart API. Get started!
  • 🧰 Resources: this is the hub of all CoCart resources to help you build a headless store. Get resources!
  • 👪 Community: use our Discord chat room to share any doubts, feedback and meet great people. This is your place too to share how are you planning to use CoCart!
  • 🐞 GitHub: we use GitHub for bugs and pull requests, doubts are solved with the community.
  • 🐦 Social media: a more informal place to interact with CoCart users, reach out to us on Twitter.
  • 💌 Newsletter: do you want to receive the latest plugin updates and news? Subscribe here.

Get involved

Do you like the idea of creating a headless store with WooCommerce? Got questions or feedback? We'd love to hear from you. Come join our community! ❤️

CoCart also welcomes contributions. There are many ways to support the project! If you don't know where to start, this guide might help >> How to contribute?


Credits

Website cocartapi.com  ·  GitHub @co-cart  ·  Twitter @cocartapi


CoCart is developed and maintained by Sébastien Dumont. Founder of CoCart Headless, LLC.

Website sebastiendumont.com  ·  GitHub @seb86  ·  Twitter @sebd86

co-cart's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

co-cart's Issues

Update /item doesn't work

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 included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

Upgraded the plugin from 1.0.8 and ran into issues in update item endpoint.
https://co-cart.github.io/co-cart-docs/index.html#update-item-in-cart loads and responds with increased to {count} of item, but the qunatity change is never reflected in the get-cart endpoint.

Easiest way to reproduce is using an app like Postman

  1. /wp-json/cocart/v1/get-cart should return an empty cart.
  2. /wp-json/cocart/v1/add-item?product_id={id}&variation_id={variation} will return and also return correct cart in the future.
  3. /wp-json/cocart/v1/get-cart returns the cart with one item added.
  4. /wp-json/cocart/v1/item?cart_item_key={4ba5788f766244ca1aa3f533008c19e9}&quantity=4 should add a quantity of four of the declared cart_item_key. Will get correct a correct response saying increased to 4.
  5. /wp-json/cocart/v1/get-cart should return one item with the new set quantity of 4, but doesn't. The response is the same as step 3, with quantity unchanged.

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.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` ` ### WordPress Environment ###

WC Version: 3.7.0
REST API Version: ✔ 1.0.2
Log Directory Writable: ✔
WP Version: ❌ 5.1.1 - There is a newer version of WordPress available (5.2.2)
WP Multisite: –
WP Memory Limit: 512 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_US
External object cache: –

Server Environment

Server Info: Apache
PHP Version: 7.2.20-2+ubuntu18.04.1+deb.sury.org+1
PHP Post Max Size: 100 MB
PHP Time Limit: 3600
PHP Max Input Vars: 1000
cURL Version: 7.58.0
OpenSSL/1.1.1c

SUHOSIN Installed: –
MySQL Version: 5.7.26-29-log
Max Upload Size: 50 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 3.7.0
WC Database Prefix: wp_
Total Database Size: 8.93MB
Database Data Size: 4.47MB
Database Index Size: 4.46MB
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.08MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.38MB + Index: 0.39MB + 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_cocart_carts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.06MB + Index: 0.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_options: Data: 1.06MB + Index: 0.06MB + Engine InnoDB
wp_pmxe_exports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxe_google_cats: Data: 0.39MB + Index: 0.00MB + Engine InnoDB
wp_pmxe_posts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxe_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxi_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxi_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxi_images: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxi_imports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_pmxi_posts: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_pmxi_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_postmeta: Data: 1.52MB + Index: 3.00MB + Engine InnoDB
wp_posts: Data: 0.30MB + Index: 0.13MB + 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_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + 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

Security

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

Active Plugins (6)

CoCart: by Sébastien Dumont – 2.1.0-beta.2 – Not tested with the active version of WooCommerce
Kadence WooCommerce Email Designer: by Kadence Themes – 1.1.9 – Not tested with the active version of WooCommerce
Klarna Order Management for WooCommerce: by klarna
krokedil
automattic – 1.2.4 – Not tested with the active version of WooCommerce

Klarna Payments for WooCommerce: by krokedil
klarna
automattic – 1.6.4 – Not tested with the active version of WooCommerce

Booster for WooCommerce: by Algoritmika Ltd – 4.1.0 – Not tested with the active version of WooCommerce
WooCommerce: by Automattic – 3.7.0

Dropin Plugins (1)

advanced-cache.php: advanced-cache.php

Must Use Plugins (4)

Force Strong Passwords - WPE Edition: by Jason Cosper – 1.6.4
Stop long comments: by WPEngine – 0.0.4
WP Engine Security Auditor: by wpengine – 1.0.7
WP Engine System: by WP Engine – 3.2.1

Settings

API Enabled: –
Force SSL: –
Currency: SEK (kr)
Currency Position: right
Thousand Separator:
Decimal Separator: ,
Number of Decimals: 0
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: #101 - /shop/
Cart: #104 - /cart/
Checkout: #103 - /103-2/
My account: #102 - /my-account/
Terms and conditions: ❌ Page not set

Theme

Name: Twenty Seventeen
Version: 1.9 – 2.2 is available
Author URL: https://wordpress.org/
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: –
`

</details>
    

Cart Validation

I would suggest working on this after all endpoints have been created and work well to handle the data for all product types and meta data.

CoCart doesnt update item on cart when I reload cart

Hello folks,

I've been used CoCart in my SPA Woocommerce and it has been amazing!
However, I found a bug in the update_item endpoint.

When I update a product quantity, it works and returns the new cart with the correct quantity. However, when I call get-cart endpoint after update_item, the cart is the same as before updating the product quantity.

It seems that cart data wasn't persisted.

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 included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

  1. Add item to cart with '/wp-json/cocart/v1/add-item'
  2. Update item in Cart with '/wp-json/cocart/v1/item'. (At this point, if I use 'return_cart' argument as true, the cart content returns correctly, but it doesn't on folllowing steps.)
  3. Get cart contents with ' /wp-json/cocart/v1/get-cart'

Expected/actual behaviour

When I follow those steps, I see the cart contents as if I'm not doing the second step. That is, the cart contents is not being updating.

I was expecting to see the cart contents updated.

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.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

Wordpress - 5.1.1
Woocommerce - 6.3.5
PHP - 7.3.1

Mixing carts between users

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 WooCommerce Cart REST-API 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 included a failing test as a pull request (Optional)

Steps to reproduce the issue

  1. Add a product cart with different users
  2. Call get cart action
  3. You will see items of another user

Expected/actual behaviour

When I follow those steps, I see that the cart is being mixed between different users.

I was expecting to see cart only of myself.

So user A will add product 1, user B will add product 2. After that user A will see product 1 and 2 in he's shopping card, user B will see also two products.

Isolating the problem

  • This bug happens with only WooCommerce Cart REST-API plugin active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the latest release of WooCommerce active.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` ### WordPress Environment ###

Home URL: https://www.hidden.com
Site URL: https://www.hidden.com
WC Version: 3.3.4
Log Directory Writable: ✔
WP Version: 4.9.5
WP Multisite: –
WP Memory Limit: 2 GB
WP Debug Mode: –
WP Cron: ✔
Language: en_EN

Server Environment

Server Info: nginx/1.12.2
PHP Version: 7.0.28-0ubuntu0.16.04.1
PHP Post Max Size: 256 MB
PHP Time Limit: 180
PHP Max Input Vars: 2000
cURL Version: 7.47.0
OpenSSL/1.0.2g

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

Database

WC Database Version: 3.3.4
WC Database Prefix: wp_
MaxMind GeoIP Database: ✔
Totale databasegrootte: 441.10MB
Database datagrootte: 286.03MB
Database index grootte: 155.07MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
wp_woocommerce_order_items: Data: 0.06MB + Index: 0.02MB
wp_woocommerce_order_itemmeta: Data: 0.25MB + Index: 0.22MB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB
wp_comments: Data: 0.14MB + Index: 0.09MB
wp_links: Data: 0.02MB + Index: 0.02MB
wp_options: Data: 3.52MB + Index: 0.63MB
wp_postmeta: Data: 200.77MB + Index: 74.20MB
wp_posts: Data: 29.56MB + Index: 11.63MB
wp_smush_dir_images: Data: 0.02MB + Index: 0.03MB
wp_termmeta: Data: 1.52MB + Index: 2.02MB
wp_terms: Data: 0.19MB + Index: 0.25MB
wp_term_relationships: Data: 3.52MB + Index: 3.52MB
wp_term_taxonomy: Data: 0.23MB + Index: 0.27MB
wp_usermeta: Data: 0.39MB + Index: 0.20MB
wp_users: Data: 0.02MB + Index: 0.05MB
wp_wcpv_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB
wp_wfBadLeechers: Data: 0.02MB + Index: 0.00MB
wp_wfBlockedCommentLog: Data: 0.02MB + Index: 0.00MB
wp_wfBlockedIPLog: Data: 0.02MB + Index: 0.00MB
wp_wfBlocks7: Data: 0.02MB + Index: 0.05MB
wp_wfConfig: Data: 0.42MB + Index: 0.00MB
wp_wfCrawlers: Data: 0.02MB + Index: 0.00MB
wp_wfFileChanges: Data: 0.02MB + Index: 0.00MB
wp_wfFileMods: Data: 2.52MB + Index: 0.00MB
wp_wfHits: Data: 0.06MB + Index: 0.05MB
wp_wfHoover: Data: 0.02MB + Index: 0.02MB
wp_wfIssues: Data: 0.02MB + Index: 0.06MB
wp_wfKnownFileList: Data: 1.52MB + Index: 0.00MB
wp_wfLeechers: Data: 0.02MB + Index: 0.00MB
wp_wfLocs: Data: 0.02MB + Index: 0.00MB
wp_wfLogins: Data: 0.02MB + Index: 0.03MB
wp_wfNet404s: Data: 0.02MB + Index: 0.02MB
wp_wfNotifications: Data: 0.02MB + Index: 0.00MB
wp_wfPendingIssues: Data: 0.02MB + Index: 0.06MB
wp_wfReverseCache: Data: 0.02MB + Index: 0.00MB
wp_wfScanners: Data: 0.02MB + Index: 0.00MB
wp_wfSNIPCache: Data: 0.02MB + Index: 0.05MB
wp_wfStatus: Data: 0.06MB + Index: 0.03MB
wp_wfVulnScanners: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_multisafepay: Data: 0.02MB + Index: 0.00MB
wp_wpmelon_advbedit_temp: Data: 0.02MB + Index: 0.00MB
wp_wps_hit: Data: 0.16MB + Index: 0.59MB
wp_wps_index: Data: 35.58MB + Index: 55.69MB
wp_wps_key: Data: 4.52MB + Index: 4.52MB
wp_wps_object_type: Data: 0.02MB + Index: 0.08MB
wp_wps_query: Data: 0.05MB + Index: 0.02MB
wp_wps_uri: Data: 0.09MB + Index: 0.08MB
wp_wps_user_agent: Data: 0.02MB + Index: 0.02MB

Post Type Counts

acf-field: 132
acf-field-group: 14
attachment: 36657
banner: 121
customize_changeset: 15
jetpack_migration: 2
nav_menu_item: 502
page: 18
post: 20
product: 19719
product_variation: 122
revision: 232
shop_coupon: 4
shop_order: 102

Security

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

Active Plugins (29)

Admin Columns Pro - Advanced Custom Fields (ACF): door Admin Columns – 2.2.2
Admin Columns Pro - WooCommerce: door Admin Columns – 3.0.5
ACF to REST API: door Aires Gonçalves – 3.1.0
Admin Columns Pro: door Admin Columns – 4.2.8
Advanced Custom Fields PRO: door Elliot Condon – 5.6.10
Autoptimize: door Frank Goossens (futtta) – 2.3.4
Capability Manager Enhanced: door Jordi Canals
Kevin Behrens – 1.5.7

Cart REST API for WooCommerce: door Sébastien Dumont – 1.0.1
Duplicate Post: door Enrico Battocchi – 3.2.1
Easy WP SMTP: door wpecommerce – 1.3.5
Facebook Login Pro: door Damian Logghe – 1.4.1
JSON Basic Authentication CUSTOM CHANGES!!!!!: door WordPress API Team – 0.1
JWT Authentication for WP-API CUSTOM CHANGES!!!!!: door Enrique Chavez – 1.2.4
Loco Translate: door Tim Whitlock – 2.1.2
Multisafepay: door Multisafepay – 3.0.4
Regenerate Thumbnails: door Alex Mills (Viper007Bond) – 3.0.2
WooCommerce Add GTIN: door Scott Bolinger – 0.1.1 – Niet getest met de actieve versie van WooCommerce
Woocommerce Advanced Bulk Edit: door George Iron – 4.3.4
Campaign Monitor Transactional Emails for WooCommerce: door Jeroen Sormani – 1.1.0.1 – Niet getest met de actieve versie van WooCommerce
WooCommerce Product Search CUSTOM CHANGES!!!!!: door itthinx – 2.0.4
WooCommerce Product Vendors: door WooCommerce – 2.1.4
WooCommerce Products Compare: door WooCommerce – 1.0.9
WooCommerce Variation Swatches and Photos: door Lucas Stark – 3.0.6
WooCommerce: door Automattic – 3.3.4 – 3.3.5 is beschikbaar
WP Smush: door WPMU DEV – 2.7.8
YITH WooCommerce Ajax Product Filter Premium CUSTOM CHANGES!!!!!: door YITHEMES – 3.5.1
YITH WooCommerce Brands Add-on Premium: door Yithemes – 1.2.1

Settings

API Enabled: ✔
Force SSL: –
Currency: EUR (€)
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)

WC Pages

Winkelbasis: #4 - /shop/
Winkelmand: #5 - /cart/
Afrekenen: #6 - /checkout/
Mijn account: #7 - /mijn-account/
Algemene voorwaarden: #55 - /algemene-voorwaarden/

Theme

Name: UnderStrap
Version: 0.8.1 – 0.8.2 is beschikbaar
Author URL: http://www.holgerkoenemann.de
Child Theme: ❌ – Als je wijzigingen aanbrengt in WooCommerce of in een hoofdthema dat je niet zelf gebouwd hebt
raden we het gebruik van een child thema aan. Zie: Hoe maak je een child thema

WooCommerce Support: ✔

Templates

Archive Template: Jouw thema heeft een woocommerce.php bestand. Je zal het woocommerce/archive-product.php template niet kunnen overschrijven omdat woocommerce.php prioriteit heeft over archive-product.php. Dit is bedoeld om weergave-problemen te voorkomen.
Overrides: understrap/woocommerce/archive-product.php
understrap/woocommerce/cart/cart-empty.php
understrap/woocommerce/cart/cart.php
understrap/woocommerce/cart/mini-cart.php
understrap/woocommerce/cart/proceed-to-checkout-button.php
understrap/woocommerce/checkout/form-checkout.php
understrap/woocommerce/checkout/form-coupon.php
understrap/woocommerce/checkout/form-pay.php
understrap/woocommerce/checkout/payment.php
understrap/woocommerce/content-product.php
understrap/woocommerce/content-single-product.php
understrap/woocommerce/global/form-login.php
understrap/woocommerce/global/quantity-input.php
understrap/woocommerce/global/wrapper-end.php
understrap/woocommerce/global/wrapper-start.php
understrap/woocommerce/loop/add-to-cart.php
understrap/woocommerce/loop/loop-end.php
understrap/woocommerce/loop/loop-start.php
understrap/woocommerce/loop/orderby.php
understrap/woocommerce/loop/price.php
understrap/woocommerce/myaccount/downloads.php
understrap/woocommerce/myaccount/form-edit-account.php
understrap/woocommerce/myaccount/form-edit-address.php
understrap/woocommerce/myaccount/form-login.php
understrap/woocommerce/myaccount/form-lost-password.php
understrap/woocommerce/myaccount/form-reset-password.php
understrap/woocommerce/myaccount/my-address.php
understrap/woocommerce/myaccount/my-orders.php
understrap/woocommerce/myaccount/navigation.php
understrap/woocommerce/myaccount/orders.php
understrap/woocommerce/product-searchform.php
understrap/woocommerce/single-product/add-to-cart/simple.php
understrap/woocommerce/single-product/add-to-cart/variation-add-to-cart-button.php
understrap/woocommerce/single-product/meta.php
understrap/woocommerce/single-product/product-thumbnails.php versie 3.3.0 is verouderd. De hoofdversie is 3.3.2
understrap/woocommerce/single-product/rating.php
understrap/woocommerce/single-product/review-rating.php
understrap/woocommerce/single-product/short-description.php
understrap/woocommerce/single-product/tabs/additional-information.php
understrap/woocommerce/single-product/tabs/description.php
understrap/woocommerce/single-product/tabs/tabs.php
understrap/woocommerce/single-product.php

Outdated Templates: ❌Leer hoe te updaten

Store Catalog PDF Download

Template Overrides: ```

Question: How to view cart contents?

I was successfull on adding product to cart, but how do we view those cart without loggin in, Does this plugin needs extra setting to view the cart if you are not logged in users. I am getting empty cart. I would be so glad if you can help me out

Question of the object name

Hi, Im using this plugin for my e-commerce service and I really think this is a nice library!
It is working very good so far!

I have one question on adding an original parameter to the response.
I know how to use the register_rest_field function but don't know the object name which I should define to point the endpoint I want to modify.
Could you give me the object name for the cart data response?

Side Cart Plugin using the Cart API

Hello.

I wanted to know if anyone of you currently watching or started this repository are interested in a side cart that appears when items are in the cart or added to the cart and uses the cart API rather than the cart widget?

James Koster has done something similar to what I would like to do but my version would use the REST API instead. He currently has 40,000 active installs which is great but has also not updated it in a year.

I hope to make my version faster and refresh live as items are being added to the cart and more customisable for all themes.

Would like some feedback or suggestions before I begin so I would very much appreciate it if you could comment below.

Also, would you be supportive of the development and maintenance of such a plugin?

If interested vote with the emoji 👍
If not interested vote with the emoji 👎
If you would like to support the project vote with the emoji ❤️

I look forward to your responses.

regards,

Sébastien.

Add to cart does not send product_name to the API

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 Cart REST-API for WooCommerce 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 included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

  1. Make Add to Cart request using the cart/add endpoint
  2. console.log(response)
  3. product_name is not returned in the JSON data

I thought my request was configured improperly at first but I looked at the class-wc-rest-cart-controller.php file and in the add_to_cart function starting on line 276, product_name is never added to the $data array, so it is never sent and thus not returned in the original response.

It looks like WooCommerce figures out which product to add to the cart solely by the id so when you reload the page and get the current cart contents, product_name is returned. But, I'm trying to update my cart with the initial response and the name is missing :)

Alternatively, I could send this with the data parameter but it is not clear how that needs to be formatted in the docs. I tried sending an object, an array, or individual value and could not get it to work. In the docs it says the parameter is data but in the class-wc-rest-cart-controller.php file it looks like the parameter is cart_item_data. How do we add additional data to the Add To Cart request?

Thanks!

Expected/actual behaviour

When I follow those steps, I see...

no product_name value in the initial response from the Add To Cart endpoint

I was expecting to see...

product_name there.

Isolating the problem

  • This bug happens with only WooCommerce and Cart REST-API for WooCommerce 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.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

Not WordPress related per se...I'm making the requests client-side.

``` Go to "WooCommerce > System Status then copy and paste the system status report here. ```

rest_no_route response came when we removing the cart item

Steps to reproduce the issue

removing cart item using delete method
rest_no_route response
cart response

  1. It is working fine when we retrieved the cart contents from '/wp-json/wc/v2/cart" call

  2. But I have got rest_no_route response when I am trying to remove the cart item by using "/wp-json/wc/v2/cart?cart_item_key=<cart_item_key>" (used DELETE method)

  3. Please refer SS

Please add Coupon's idea in Plugin

Hello Dear Developers, please add Coupon's idea in Plugin. You've helped me a lot. Or if you can show me how I can do it myself.
Thank you!

Feature: Check stock of cart items

Hey,

In my implementation I have added an endpoint to check the stock of all the cart items to make sure they are still in stock before proceeding to the checkout.

Feel free to implement, this is a very basic version. Could write something that returned a bit more than just an error with a string in it.

// Check Cart Stock - wc/v2/cart/check_stock (GET)
register_rest_route( $this->namespace, '/' . $this->rest_base  . '/check_stock', array(
	'methods'  => WP_REST_Server::READABLE,
	'callback' => array( $this, 'check_stock' ),
));
/**
 * Returns whether the cart items are in stock.
 *
 * @access public
 * @since  1.0.6
 * @return array
 */
public function check_stock() {
	$check = WC()->cart->check_cart_item_stock();

	return $check;
} // END check_stock()()

Invalid Argument Error for foreach()

Hello, I have found the Issue When there call the get cart API. calling the rest with /wc/v2/cart.
Errors are in the file WooCommerce-Cart-REST-API-master\includes\api\class-wc-rest-cart-controller.php

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 WooCommerce Cart REST-API 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 included a failing test as a pull request (Optional)

Steps to reproduce the issue

  1. Download the latest plugin and activate in your setup.
  2. Setup the WooCommerce Store and API Keys.
  3. Call the get cart API by wc/v2/cart.

Expected/actual behavior

When I follow those steps, I see the error Warning: Invalid argument supplied for foreach() in D:\woocommerce-api\wp-content\plugins\WooCommerce-Cart-REST-API-master\includes\api\class-wc-rest-cart-controller.php on line 164

And

Warning: Cannot modify header information - headers already sent by (output started at D:\woocommerce-api\wp-content\plugins\WooCommerce-Cart-REST-API-master\includes\api\class-wc-rest-cart-controller.php:164) in D:\woocommerce-api\wp-includes\rest-api\class-wp-rest-server.php on line 1248

I was expecting to see...
"Cart is Empty!"

Isolating the problem

  • This bug happens with only WooCommerce Cart REST-API plugin active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the latest release of WooCommerce active.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` Go to "WooCommerce > System Status then copy and paste the system status report here. ```

Unable to remove item from cart

Sorry, if this is the right place to post this, but I have no idea where to reach help.
i'm creating an ios application for woocommerce website and I was able to use this plugin to add product to cart , view cart , and clear cart , but I could not get through with the delete request to remove an item from cart , below is the screen short I used postman to test out

------ GET request
screen shot 2018-04-05 at 3 11 12 pm
------ DELETE request
screen shot 2018-04-05 at 3 05 31 pm

syntax error with the function name.

The plugin code has the syntax error with the function name.

I have installed the latest version of WordPress( 4.9.4 ), WooCommerce ( 3.3.4 ) and latest version of cart rest api for woocommerce plugin.

When I have clicked on the Activate plugin option of this plugin it gives the syntax error unexpected include in WooCommerce-Cart-REST-API\includes\class-wc-cart-rest-api-init.php on line 57

Prerequisites

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

Steps to reproduce the issue

  1. Setup the latest version of WordPress and WooCommerce.
  2. Install and activate the latest version of this plugin.

Expected/actual behavior

When I follow those steps, I see the error as I have described above.

I was expecting to see the plugin activate successfully.

Isolating the problem

  • This bug happens with only WooCommerce Cart REST-API plugin active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the latest release of WooCommerce active.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` Go to "WooCommerce > System Status then copy and paste the system status report here. ```

Determin which cart to get

To further improve detection of the cart and its contents based on the user status without requiring to authenticate we need to do an object check.

This check will determine to which version of the cart we have access to. If the cart is not empty or set then we will get the cart contents from the cart class, otherwise, we will get the cart contents from the session.

Help with testing this change will be required.

Cart for each user

Hey,

So i've been wondering how to I use this plugin to work with carts from specific users? It's not clear in the documentation.

I would have assumed making a request such as..

http://domain.com/wp-json/wc/v2/cart/ -u consumer_key:consumer_secret

Prerequisites

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

Steps to reproduce the issue

  1. Install Cart REST API Plugin to fresh Woo and Wordpress instance.
  2. Make a request to the Cart API e.g. http://domain.com/wp-json/wc/v2/cart/

Expected/actual behaviour

When I follow those steps, I see...

I get a successful result such as "Cart is empty"

I was expecting to see...

No response as i'm not passing any consumer key or secret, or authentication in the request.

Isolating the problem

  • [ X ] This bug happens with only WooCommerce and Cart REST-API for WooCommerce plugin are active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the WordPress theme Storefront active.
  • [ X ] This bug happens with the latest release of WooCommerce active.
  • [ X ] I can reproduce this bug consistently using the steps above.

WordPress Environment

``` Go to "WooCommerce > System Status then copy and paste the system status report here. ```

Fatal error when adding a product with quantity higher than what is left in stock

If we have product with quantity 3 ( In stock (3) ) and i try add product with 5 quantity, i must see JSON with error but i see php error.

i use ajax

request:

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.open("POST", "/wp-json/wc/v2/cart/add", true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
...
xhr.send(`{
"product_id":27,
"quantity":5
}`);

response:

<b>Fatal error</b>:  Exceptions must be valid objects derived from the Exception base class in <b>/var/www/wp-react.cot/wp-content/plugins/cart-rest-api-for-woocommerce/includes/api/class-wc-rest-cart-controller.php</b> on line <b>324</b><br />

Handling WC Notices

Thanks for the plugin! I'm working on implementing coupon endpoints, and I've noticed that cart-rest-api-for-woocommerce ignores WooCommerce notices (as far as I can tell).

Here's roughly how notices work: anytime WC wants to show the user a message it adds it to an array stored in WC()->session. Next time a page is rendered the queued notices are emptied onto the page. But the Cart API doesn't ever empty notices, so throughout usage, notices build up on the server.

Since the status handling on coupon actions isn't handled very nicely by WooCommerce, in order to send back a status such as "Coupon code already applied!", I need to send notices back with the request. Right now I'm sending back a diff of the notices from the start of the method with the notices at the end of the method. Theoretically, this means I'm only sending back the notice(s) that the request generated.

In general, how do you think this should be handled? It seems to me that we should send notices back with the API requests that generate them, and clear the notice queue.

Thanks!

'validate_callback' 'is_numeric' arguments for Add Item rest route causes Fatal Error

Using the php WooCommerce rest api library, I was getting a fatal error when adding items to cart:

$data = [
   "product_id" => 234,
   "quantity" => 1
];

$woocommerce->post('cart/add', $data);

Fatal error: Uncaught exception 'Automattic\WooCommerce\HttpClient\HttpClientException' with message 'unexpected character' in .../wc-api-php/WooCommerce/HttpClient/HttpClient.php

This fatal error was being caused because a warning was being thrown

Warning: is_numeric() expects exactly 1 parameter, 3 given in .../wp-includes/rest-api/class-wp-rest-request.php on line 858

which caused the callback function to be called with invalid data.

The issue is naming the 'is_numeric' function as the 'validate_callback' for integers arguments set for the rest route for Add Item in class-wc-rest-cart-controller.php :

'args'     => array(
   'product_id' => array(
	'validate_callback' => 'is_numeric'
   ),
   'quantity' => array(
	'validate_callback' => 'is_numeric'
   ),
   'variation_id' => array(
	'validate_callback' => 'is_numeric'
   ),

This exact issue is described in the Custom Endpoint docs for the Wordpress Rest API in the Arguments section: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/

You could also pass in a function name to validate_callback, but passing certain functions like is_numeric directly will not only throw a warning about having extra parameters passed to it, but will also return NULL causing the callback function to be called with invalid data. We hope to eventually solve this problem in WordPress core.

The problem seems to be solved by using their example format, as opposed to naming the 'is_numeric' function:

'args' => array(
      'id' => array(
        'validate_callback' => function($param, $request, $key) {
          return is_numeric( $param );
        }
      ),

Clearing the cart should return an empty array

First, this is great plugin so thank you!

I'm having issues with the Clear Cart endpoint: in a React app, it is quite common to have to filter an array to update state and/or send props to child components from a filtered/mapped array.

When you use the clear endpoint, it returns the string "Cart is empty!" which makes it really difficult to fully clear the cart. When I removed the string from the plugin in class-wc-rest-cart-controller.php at line 167, everything works as normal: I can clear the cart update my state to: cart: [].

Without removing the string, if I reload, since I'm filtering the cart to an array using map and Object.values, it will return the 'Cart is empty!' string as indexed letters in the array, e.g. `0: "C", 1: "a", 2: "r", 3: "t",...

Is the 'Cart is empty!' string really necessary? It should be easy enough to add whatever 'Empty cart' message you may need on the client side and ideally when the cart is cleared it should return an empty array, not a string.

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 Cart REST-API for WooCommerce 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 included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

  1. Use the clear endpoint to clear the cart
  2. Update React application state (e.g. state= { cart: [] }
  3. Reload.
  4. Cart is not empty; includes 'Cart is empty!' string; would fail boolean or length test

Expected/actual behaviour

Using the clear endpoint should return an empty array.

Isolating the problem

  • This bug happens with only WooCommerce and Cart REST-API for WooCommerce 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.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` Go to "WooCommerce > System Status then copy and paste the system status report here. ```

Question: Do the cart totals not change after calculating totals?

It has been brought to my attention that calculating totals is not working via the API should you be using woocommerce_before_calculate_totals and woocommerce_after_calculate_totals action hooks.

If you are also experiencing the same issue, please comment below so I can sort this out or if you have any suggestions.

Really appreciate it.

Thank you.

Facing 404 error when we triggered API call using REST API

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 WooCommerce Cart REST-API 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.

Steps to reproduce the issue

  1. I have installed and activated this plugin.
  2. By triggering the API call, facing 404 error.
  3. Details below,
    API URL : http://sample.dev.net/wc/v2/cart/clear
    Method : GET
    Error : 404 page not found

Isolating the problem

  • This bug happens with only WooCommerce Cart REST-API plugin active.
  • This bug happens with the latest release of WooCommerce active.
  • I can reproduce this bug consistently using the steps above.

Add to cart POST is missing cart item data check

On line 102 of the class-wc-rest-cart-controller file the cart_item_data (also the variation on line 99) is blocking the request. 'is_array' won't be recognized as a valid function. To solve this we can create our own function.

<?php
register_rest_route( $this->namespace, '/' . $this->rest_base . '/add', array(
	'methods'  => WP_REST_Server::CREATABLE,
	'callback' => array( $this, 'add_to_cart' ),
	'args'     => array(
		'product_id' => array(
			'validate_callback' => function( $param ) {
				return is_numeric( $param );
			}
		),
		'quantity' => array(
			'validate_callback' => function( $param ) {
				return is_numeric( $param );
			}
		),
		'variation_id' => array(
			'validate_callback' => function( $param ) {
				return is_numeric( $param );
			}
		),
		'variation' => array(
			'validate_callback' => function( $param ) {
				return is_array( $param );
			}
		),
		'cart_item_data' => array(
			'validate_callback' => function( $param ) {
				return is_array( $param );
			}
		)
	)
) );
?>

This will allow me to add custom data to my cart. I'll create a PR after this issue.

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 Cart REST-API for WooCommerce 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 included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

  1. Create a POST to cart/add
  2. Add a param with the key cart_item_data (array is accepted according to the docs)

Expected/actual behaviour

If you follow these steps you will result in an error: error: 400, Invalid parameter(s):
It should return the product added to the cart instead.

If we use the solution I described the expected outcome will return including the extra data.

Isolating the problem

  • This bug happens with only WooCommerce and Cart REST-API for WooCommerce 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.
  • I can reproduce this bug consistently using the steps above.

Shipping Rate

Now as you have the api to manage cart, are you planning to add one for calculating shipping rates?

Cart items should not be shared by users

Expected/actual behaviour

Cart items should not be shared by users

but it is sharing all cart items

I've tested on VVV, and real server (below LINK, anyone can test it using 'ADD TO CART button')
Link

What can I do?

Delete cart return ok but nothing is deleted

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 Cart REST-API for WooCommerce 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 included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

  1. add a product in cart
  2. get cart_item_key
  3. call delete with cart_item_key

Expected/actual behaviour

When I follow those steps, I see: http 200 and the response is "Item has been removed from cart." but the product is still in the cart

I was expecting to see : the product diseapear from the cart

Isolating the problem

  • This bug happens with only WooCommerce and Cart REST-API for WooCommerce 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.
  • I can reproduce this bug consistently using the steps above.

Add, update and get works fine.

WordPress Environment

` ### WordPress Environment ###

WC Version: 3.4.4
Log Directory Writable: ✔
WP Version: 4.9.8
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_US
External object cache: –

Server Environment

Server Info: nginx/1.12.2
PHP Version: 5.4.16 - ❌ WooCommerce will run under this version of PHP
however
it has reached end of life. We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version

PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.29.0
NSS/3.34

SUHOSIN Installed: –
MySQL Version: 5.5.60-MariaDB
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: ❌ Your server does not have the DOMDocument class enabled - HTML/Multipart emails
and also some extensions
will not work without DOMDocument.

GZip: ✔
Multibyte String: ❌ Your server does not support the mbstring functions - this is required for better character encoding. Some fallbacks will be used instead for it.
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 3.4.4
WC Database Prefix: wp_
MaxMind GeoIP Database: ✔
Total Database Size: 10.84MB
Database Data Size: 5.80MB
Database Index Size: 5.04MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB
wp_comments: Data: 0.02MB + Index: 0.09MB
wp_links: Data: 0.02MB + Index: 0.02MB
wp_options: Data: 2.03MB + Index: 0.02MB
wp_postmeta: Data: 2.02MB + Index: 4.05MB
wp_posts: Data: 1.19MB + Index: 0.20MB
wp_termmeta: Data: 0.02MB + Index: 0.03MB
wp_terms: Data: 0.02MB + Index: 0.03MB
wp_term_relationships: Data: 0.08MB + Index: 0.05MB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB
wp_usermeta: Data: 0.02MB + Index: 0.03MB
wp_users: Data: 0.02MB + Index: 0.05MB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB

Post Type Counts

attachment: 323
page: 26
post: 2
product: 452
revision: 31

Security

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

Active Plugins (2)

Cart REST API for WooCommerce: by Sébastien Dumont – 1.0.4
WooCommerce: by Automattic – 3.4.4

Settings

API Enabled: –
Force SSL: –
Currency: EUR (€)
Currency Position: right
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)

WC Pages

Shop base: #5 - /shop/
Cart: #6 - /divers/cart/
Checkout: #7 - /divers/checkout/
My account: #8 - /divers/my-account/
Terms and conditions: ❌ Page not set

Theme

Name: Shop Isle
Version: 1.1.46
Author URL: https://themeisle.com
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: –
`

API document link invalid

Not a big issue, but think you should know the link to the document in your readme file does not work, it looks not professional so if possible, please fix it.
image

Add Featured Product Image URL to Cart Endpoint

Would it be practical for the featured product image URL to be added to the cart endpoint per product so you would not have to do another request to get it?

This is what the cart endpoint returns currently as default.

Cart endpoint with a product in cart.

The same returns when WC()->cart->get_cart(); is called but if you were to use the cart endpoint to display the products in the cart you don't have the featured product image to display with.

So do think it would be ok to add this variable to each product in the cart or would it cause performance issues?

Not compatible with WooCommerce 3.6.2

Hi,
your fix for WC 3.6.1 don't work on the last update of WC 3.6.2...
I get a error 500 response, same bug you fixed recently.

Anyway thanks for your work and your plugin.
I'll look carefully to the WC update now ! :D

And do you know why WC chose to not implement "add to cart" endpoint in their API ?

Completely broken with wp-api-php library

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 Cart REST-API for WooCommerce 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 included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

  1. Install wordpress
  2. Install woocommerce
  3. Enable rest api and get key and secret
  4. Install cart rest api for woocommerce
  5. Install woocommerce api php client https://github.com/woocommerce/wc-api-php
  6. Add item to cart logged in as admin user
  7. add print_r($woocommerce->get('cart')); to header.php file
  8. visit site from another device
  9. can see contents of cart printed

Expected/actual behaviour

After developing extensively relying on this plugin, I eventually got to testing with a different user/browser/device and realised the plugin was always interacting with the same cart. It's easy to see the problem, just go to the test site I set up https://bight.pillbox.co.za/ . You will see the result of

global $woocommerce;
print_r($woocommerce->get('cart'));

there (which is in storefront header.php). How is it possible that a cart is being fetched there? You have never visited the site and are not logged in. The test site is a clean wordpress and woocommerce with no extra plugins.

I expect that $woocommerce->get('cart') and all other cart related api functions in the cart plugin would interact with the cart of the logged in user/current session, only but they seem to just interact with the cart of the admin/first user. Same with the post functions etc.

Essentially the cart rest api calls are always interacting with a single cart which has nothing to do with the current user/session.

Am I missing something basic here or does the 'php' aspect of the cart api plugin not work with WooCommerce API - PHP Client?

Aside from installing woocommerce and cart rest api plugin, the only other changes I have made are to include the WooCommerce API - PHP Client like so (might making $woocommerce global have something to do with it?):

Contents of wc-api-init:

require __DIR__ . '/WooCommerce/Client.php';
require __DIR__ . '/WooCommerce/HttpClient/BasicAuth.php';
require __DIR__ . '/WooCommerce/HttpClient/HttpClient.php';
require __DIR__ . '/WooCommerce/HttpClient/HttpClientException.php';
require __DIR__ . '/WooCommerce/HttpClient/OAuth.php';
require __DIR__ . '/WooCommerce/HttpClient/Options.php';
require __DIR__ . '/WooCommerce/HttpClient/Request.php';
require __DIR__ . '/WooCommerce/HttpClient/Response.php';

use Automattic\WooCommerce\Client;

global $woocommerce;
$woocommerce = new Client(
    'http://bight.pillbox.co.za', 
    'ck_c8a3ef5088180731901999f8faf07fccd2b4591a', 
    'cs_0560ac9c15e743f4c172159da8a0d949da97a059',
    [
        'wp_api' => true,
        'version' => 'wc/v2',
    ]
);

Contents of header.php

	<div id="content" class="site-content" tabindex="-1">
		<div class="col-full">

		<?php
		do_action( 'storefront_content_top' );

		global $woocommerce;
		print_r($woocommerce->get('cart'));

(If you want I can give you access to this install.)

Isolating the problem

  • This bug happens with only WooCommerce and Cart REST-API for WooCommerce 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.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` ` ### WordPress Environment ###

Home URL: https://bight.pillbox.co.za
Site URL: https://bight.pillbox.co.za
WC Version: 3.4.2
Log Directory Writable: ✔
WP Version: 4.9.6
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: 5.6.33-0+deb8u1 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version
PHP Post Max Size: 64 MB
PHP Time Limit: 60
PHP Max Input Vars: 2500
cURL Version: 7.38.0
OpenSSL/1.0.1t

SUHOSIN Installed: –
MySQL Version: 5.5.5-10.0.35-MariaDB-1~jessie
Max Upload Size: 64 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 3.4.2
WC Database Prefix: wp_
MaxMind GeoIP Database: ✔
Total Database Size: 1.89MB
Database Data Size: 1.05MB
Database Index Size: 0.84MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB
wp_comments: Data: 0.02MB + Index: 0.08MB
wp_links: Data: 0.02MB + Index: 0.02MB
wp_options: Data: 0.41MB + Index: 0.02MB
wp_postmeta: Data: 0.09MB + Index: 0.03MB
wp_posts: Data: 0.05MB + Index: 0.06MB
wp_termmeta: Data: 0.02MB + Index: 0.03MB
wp_terms: Data: 0.02MB + Index: 0.03MB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB
wp_usermeta: Data: 0.02MB + Index: 0.03MB
wp_users: Data: 0.02MB + Index: 0.05MB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB

Post Type Counts

attachment: 16
customize_changeset: 1
page: 8
post: 2
product: 12
revision: 2

Security

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

Active Plugins (4)

Cart REST API for WooCommerce: by Sébastien Dumont – 1.0.3 – Not tested with the active version of WooCommerce
WooCommerce PayPal Express Checkout Gateway: by WooCommerce – 1.5.6
WooCommerce Stripe Gateway: by WooCommerce – 4.1.7
WooCommerce: by Automattic – 3.4.2

Settings

API Enabled: –
Force SSL: –
Currency: GBP (£)
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)

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: Storefront
Version: 2.3.2
Author URL: https://woocommerce.com/
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: –
`

</details>

Fatal Error: Cannot throw objects that do not implement Throwable

Since WP_Error does not extend Exception, and is not implementing Throwable, then when you do:

throw new WP_Error()

it results in a fatal error, and the error messages never get sent back in the request.

Instead, you should probably be doing something else, maybe just:

return new WP_Error()

This is for all the instances of "throw new WP_Error" that are found in the plugin.

Is it possible to get any customer's shopping cart by a customer ID?

The situation is:
I have a woocommerence as backend and a python-flask middleware as frontend.
The frontend has built-in a key/secret pair associated a shop-manager-user.
The end-user sends a request to the frontend, the middleware authenticate the end-user and gets the resources from backend by the built-in key/secret pair.
So I expect to find a way for endusers to access their own cart.
Thank You.

Feedback: Support for cart storing in session

Some of you have had issues with CoCart when developing with Android so my attempt to provide support in that area is in need of your feedback. Below is a changelog on what I have developed for the next release which I hope will provide the missing link and support for future features to come.

I have explained how it works and how to use this newly added support in this blog post. If you have any questions, I will be happy to answer them here.

I look forward to your feedback.

Thank you.

regards,

Sébastien.

v2.1.0

  • NEW: Added a new endpoint for fetching products or a singular product in READ-ONLY. No authentication required.
  • NEW: Added support for guest carts.
  • NEW: Cart data are stored in a new database table.
  • NEW: Added plugin details to WooCommerce System Status.
  • NEW: Added uninstall.php file to delete tables and options.
  • Dev: Clear all carts stored in session via the Tools section of WC System Status.
  • Dev: Cart expiration can be filtered if the default 48 hours is not to your liking.
  • Dev: Cart key can be filtered before storing cart in the database and creates a cookie on the customer's device.
  • Dev: Added conditional filter for returning a cart item.

Note: Carts that have expired past 48 hours are cleared via a cron-job twice daily.
This release is a work in progress and requires developer feedback.

Download release.

Question: Please give how to add endpoint to view cart as per customer

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 WooCommerce Cart REST-API 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 included a failing test as a pull request (Optional)

Steps to reproduce the issue

Expected/actual behaviour

When I follow those steps, I see...

I was expecting to see...

Isolating the problem

  • This bug happens with only WooCommerce Cart REST-API plugin active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the latest release of WooCommerce active.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

``` Go to "WooCommerce > System Status then copy and paste the system status report here. ```

Feedback: What do you think about having saved carts added to the mix?

I'm sure many of you are also wanting the ability for customers to save items for later that they have added to the cart but what about saving the whole cart for later.

Amazon does a good job of allowing you to save items for later one item at a time but not the whole cart.
Like most e-commerce sites, Razer does not allow you to save items one at a time but does allow you to save the whole cart to your account.

So I wanted to know your thoughts. Should WooCommerce have this added as part of the core or would it be better as a feature plugin? Should it be item by item, the whole cart or both? Should the customer be able to share their cart publically?

I'm thinking this would not only be a great feature to have but to extend the Cart REST API to support it.

Leave your comments below.

Example of possibly accessing a saved cart: /wp-json/wc/v2/cart/saved-cart?cart_id=123

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.