add integration for woocommerce admin
Since WooCommerce Admin is a part of WooCommerce for a while now. It would be helpful to integrate it in laravel-woocommerce.
Since the reports you will get from .../wc/v3/reports/ include very little data they are not that useful for most users.
Integrating the analyses we get from WooCommerce Admin could help here.
For example: I have created a new Coupon via laravel-woocommerce like
$data = [
'code' => '10off',
'discount_type' => 'percent',
'amount' => '10',
'individual_use' => true,
'exclude_sale_items' => true,
'minimum_amount' => '100.00'
];
$coupon = Coupon::create($data);
$coupon_id = $coupon->id;
YourModel::
and the server responds with the coupon
{
"id": 719,
"code": "10off",
...
}
now using the ID we can easily track the coupon from outside like
$coupons = WooAnalytics::all('reports/coupons', [
'coupons' => $coupon_id,
'before' => date('Y-m-d\T00:00:00', time()),
'after' => $coupon->date_created,
...
]);
If this is something you are willing to merge I would add some changes to this PR.
This would include:
- Adding a new trait for WooCommerce Admin / Analytics to ensure only actions that can be done via the endpoint are reflected
- Easier access to the endpoint by removing the
reports/part - Automatic datetime transitions
- implementing a working
findmethod - Possible ideas that come up in the comments
Let me know what you think.
Hello @bfiessinger,
Thanks for your PR. Currently, I'm behind the schedule. I'll evaluate your request.