Documentation of the shops data exchange protocol - baselinker.com
Function list
Tests
ChangeLog
Remap Builder


ProductsQuantityUpdate
The method allows mass updating of product inventories (and their variants). Maximum 1000 products.


Input parameters
Incoming as $_POST fields.
productsArray (Sent as string in JSON format)The array of products (in JSON format). Each product is listed as a separate element, also presented as an array in the following format:
| - product_id - product identifier
| - variant_id - variant identifier (set 0 when changing the main product)
| - operation - can be "set" or "change"
| - quantity - value of operation



Outgoing data
Array fields that the method should return.
counterintNumber of processed products.



Example:
Input data:
Array
(
    [products] => Array
        (
            [0] => Array
                (
                    [product_id] => 123
                    [operation] => set
                    [quantity] => 10
                )

            [1] => Array
                (
                    [product_id] => 456
                    [variant_id] => 789
                    [operation] => change
                    [quantity] => -1
                )

        )

)

POST request:
products%5B0%5D%5Bproduct_id%5D=123&products%5B0%5D%5Boperation%5D=set&products%5B0%5D%5Bquantity%5D=10&products%5B1%5D%5Bproduct_id%5D=456&products%5B1%5D%5Bvariant_id%5D=789&products%5B1%5D%5Boperation%5D=change&products%5B1%5D%5Bquantity%5D=-1


returned data JSON:
{"counter":2}

Dane wyjściowe:
Array
(
    [counter] => 2
)