Closed scopefragger closed 8 years ago
Hi Mark,
The new version of the plugin uses the WC REST API v2 to create orders - this functionality didn't exist at the 0.3 release so I had to create the orders in the POS code.
Given that the orders are created in WC proper, all third party hooks should work okay.
If there is any problems after the next update please leave a comment below and I'll contact the COG plugin authors to find out what's going wrong.
Fantastic client will be happy! Ill keep an eye out with the client over the next patch Cheers for the fast reply.
I'm closing this issue as it should have been fixed in 0.4. Let me know if it's still an issue and I'll reopen.
Hi, this issue continue i just updates to 0.4.1 and cost of goods not working
@maxrice can you take a look at this?
It seems that Cost of Goods is using the class-wc-checkout.php hooks rather than the abstracted hooks, which means that it does not support orders created using the REST API.
Could you look at changing woocommerce_add_order_item_meta
to woocommerce_order_add_product
.
There's no common action for woocommerce_checkout_update_order_meta
but you could use woocommerce_api_create_order
to run the order_meta method for API orders.
Additionally the REST API allows editing of orders so you would need to update cog meta with woocommerce_order_edit_product
and woocommerce_api_edit_order
.
@kilbot - thanks for digging into that :smile: I believe we were using those older hooks to support WC 2.1, which we'll be dropping support for as part of our compatibility updates for WC 2.4. We'll fix this in an update later this month.
Ah yes .. backwards compatibility, that's something I keep forgetting about (being a plugin newbie).
I realise the links are probably not necessary seeing as though you created those hooks, but I thought I'd include them for anyone following along :smile:
Hi, do you have a relase date or a temporal solution for this? i will like to use new versión and dont go back to older versions
This should be resolved in the upcoming v1.8.1 version of Cost of Goods :)
great! :+1:
Does cost of goods value come back through the REST API?
@rfink just wondering if this is regarding the POS? If so, the default POS templates would need to be customised to display the Cost of Goods.
If you have the POS installed you can view the raw product JSON by going to http://<your-domain>/wc-api/v3/products/?pos=1
, this will show you which product attributes are available.
I may have actually asked this in the wrong place, I'm not sure where to ask. I'm looking to ask this question to whomever maintains the default WooCommerce REST API.
@rfink The default product JSON is shown on the WC REST API documentation. Obviously the default properties will not include data from third party plugins.
Extra product data can added by the third party plugin or by website owners to suit their requirements. Personally, I think it should be up to the individual users to customise the product JSON to fit their requirements. The API should be as fast as possible and this could become an issue if many plugins add data to the output.
Adding custom data to the product JSON is fairly easy using the woocommerce_api_product_response
filter.
A function to add cost of goods data will look something like:
function my_custom_product_response( $product_data, $product ){
$product_data['cog'] = WC_COG_Product::get_cost( $product );
return $product_data;
}
add_filter( 'woocommerce_api_product_response', 'my_custom_product_response', 10, 2 );
The above is untested but should get you close.
Hi, I don't know where to post this issue, as I don't know who the problem is.
Some weeks ago, I guess before the last 2 or 3 updates, this plugin was working fine to me. If I looked in the "orders" tab, I could see the reports of my sales, but now I only can see the report in the "profit" tab. When a client purchase something in the web, it's showing in the "order" tab, but when I use the pos, it doesn't appear. I don't know if it's possible to fix.
Hi @gepd, this bug is already on the known bugs page for 0.4.5, it will be fixed in the next version of WooCommerce POS.
Thanks for your answer @kilbot I'll wait until the next version.
Ok not so much an issue, More of a cross plugin integration issue
Our Client uses COG plugin http://www.woothemes.com/products/woocommerce-cost-of-goods/ We have patched POS to work with this plugin ( our version can be found here : https://bitbucket.org/scopefragger/pos/commits/799308ba69a62a7d7dd18ee949cdd28fe113bf10#chg-public/includes/class-pos-checkout.php ) Client is happy to share the code.
The amends are line 316, ish;
Were either looking for a way for the client to keep updating there POS plugin without losing this patch every time !