Comments (11)
Hi, me too. My attempts never succeeded. So I've skipped the problem and I have adopted the CoCart plugin with this add-on enabled.
I've made implementation at the app level, so I've no changed the library.
I hope this can help.
Happy coding.
from woocommerce.
Yes, I use CoCart only to manage the cart. So I can add/remove items to the cart and every change is saved on WordPress DB.
You can continue to use this library and add your code to implement CoCart.
from woocommerce.
Hi! No, there is no Flutter documentation.
You can find the plugin documentation here . You need to create the CoCart entities classes and then call the CoCart endpoints. As I said, I suggest using this add-on.
Happy conding!
from woocommerce.
Thank you.i use it. Thank for share. If i has issue. Pls help thank
from woocommerce.
@federico2390 As I said, this code is 15 months old.. I think you must update it. =/
If you need help, we could see it together.
For the entities, I have a Gist --> https://gist.github.com/CarloDotLog/d85d24e6e23e2f019386c5f737d1216d
The following method add an Item or Variation to CoCart.
It's based on v1 CoCart API and woocommerce: ^0.9.7.
static const String URL_COCART_API_PATH = "/wp-json/cocart/v1/";
/// Accepts an int [productId] of a product, int quantity, int [variationId] of a product or product variation
/// Related endpoint : cocart/v1/add-item
///
Future<Items> addItemToCoCart({required String cartKey, required int productId, required int quantity, int? variationId}) async {
Map<String, dynamic> data = {
'cart_key': cartKey,
'product_id': "$productId",
'quantity' : "$quantity",
};
if(variationId!=null) data['variation_id'] = "$variationId";
debugPrint("$data");
String authToken = await wooCommerce.getAuthTokenFromDb();
_urlHeader['Authorization'] = 'Bearer $authToken';
final response = await http.post(Uri.parse(baseUrl + URL_COCART_API_PATH + "add-item"), headers: _urlHeader, body: data);
debugPrint(baseUrl + URL_COCART_API_PATH + 'add-item');
if (response.statusCode >= 200 && response.statusCode < 300) {
final jsonStr = json.decode(response.body);
debugPrint("added to my cart : "+jsonStr.toString());
return Items.fromJson(jsonStr);
} else {
WooCommerceError err = WooCommerceError.fromJson(json.decode(response.body));
throw err;
}
}
from woocommerce.
Only cart use cocart? Because now i use my phone, I don't search
from woocommerce.
Yeah! I'm try it, But I will try to code using WooCart of the woocommercer package. thank you.
from woocommerce.
Yes, I use CoCart only to manage the cart. So I can add/remove items to the cart and every change is saved on WordPress DB.
You can continue to use this library and add your code to implement CoCart.
hello, do you have documentation on flutter with cocart plugin?
from woocommerce.
@CarloDotLog Do u have an example of api for adding item in cart with cocart?
from woocommerce.
Yes I have something.. somewhere... I use this package into an old project dated 1+ year.
I'll update you as soon as I find the code 😉
from woocommerce.
@CarloDotLog Yes please if u find the code can share here or via mail?
Thx for help
from woocommerce.
Related Issues (20)
- no price of any thing Total price or item count or any thing when using WooCart or WooCart items HOT 1
- auth token is showing null
- Error: type 'String is not a subtype of type int. HOT 2
- woocommerce.deleteCustomer(...) isn't working
- Woocommerce App
- Model WooShippingMethod different Woocommerce docs HOT 3
- Get a product rating count
- Future<List<WooProductCategory>> getProductCategories HOT 4
- Filtering by category/slug doesn't work HOT 1
- Update on pub.dev site
- Please implement Null safety
- Security concern on saving consumer secret in app HOT 1
- user is logged in and still fetchLoggedInUserId() method getting 'rest_not_logged_in' error HOT 1
- Every product added in cart haven't price and also "itemCount" is missing.
- fetchLoggedInUserId()
- getProducts' search parameter unclear
- Issue on getProducts
- How to run this code i can't able to run it any one help me to run this
- Please Fix order Meta Data
- Please Fix order Meta Data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from woocommerce.