Slide 21
Slide 21 text
$stockUpdates = [];
foreach ($payload['data'] as $product) {
$stockUpdates[] = ['id' => $product['id'], 'stock' => $product[‘stock’]];
}
$response = $client->post(
'https://example.com/api/_action/sync',
['body' => json_encode([
'write-product' => [
'entity' => 'product',
'action' => 'upsert',
'payload' => $stockUpdates,
]
]),
'headers' => [
'indexing-behavior' => 'use-queue-indexing',
]
);
2
1
Advanced Queues