I am using a multi inventory plug-in to store stock levels of products in Woocommerce between 3 locations - they are named 754, 753 and 752
They are stored in database in a serialised array like this:
Key: woocommerce_multi_inventory_inventories_stock
Value: a:3:{i:754;s:0:”5”;i:753;s:0:”5”;i:752;s:0:”5”;}
I am trying to use WP All Import to import stock levels into just 1 of these locations - 754 and leave the other two as they are. WP All Import can import into this serialised array but it then overrides the other 2 locations when it changes 754.
Would anyone know how a php function to use with WP All Import in order to change ONLY the stock level in 754 without adjusting the other 2?
https://www.codegrepper.com/code-examples/php/php+serialize+to+array+online
Using the above method you can create serialize data for the custom field using the key available in wp all import options.
Explanation of serialize array is as follows:
In case you were still curious about the "secondary output", its fairly simple: a = array, 3 = of size three elements within the {}'s. inside that, you have i=integer/index equalling 1, string of len 6 equalling "elem 1", integer equalling 2.. etc etc.. Its fairly clear when you read it like that. You can imagine multiple levels of arrays/objects being easily contained within, however modification is very unwise, you should really unserialize modify then serialize to ensure consistency.
Here you can find more details:
URL: How to use php serialize() and unserialize()