Open glaing opened 4 years ago
Taking Timesheets as an example
$query = $xero->load(Timesheet::class);
foreach ($array_of_employee_guids as $employee_id) {
$query->orWhere(sprintf('EmployeeID=GUID("%s")', $employee_id));
}
$timesheets = $query->execute()
Hi,
I have built a plugin for my WooCommerce site which creates a queue of products that are either missing or need updating (pricing, etc) in my Xero Inventory.
It detects if the product is new or updating and executes one of two sets of code. It then adds this to an array, so I can upload it all with one saveall() command at the end of the batch.
The new product works fine, but when updating I am using loadByGUID to connect to the product, which is creating extra inefficient API calls (and is making me hit the rate-limits).
New Product:
Updating Product
Which is finished off by:
$responses = $xero->saveAll($sendItems);
I already have the GUID of the inventory item stored as metadata on my WooCommerce products, so do I need to use a separate loadByGUID call each time? Or us there a better way to do this?
Thanks, George