Overview
When myFulfillment push product stock levels to Magento 2, it uses the following API endpoint :
PUT products/SKU/stockItems/XXX
- SKU is the product SKU
- XXX is the stock item ID
However, if the SKU contains a slash, it could break the url and create the error "Unable to find stock item ID for sku XXXXXX"
Magento itself recommends to apply a double encoding on SKUs sent to their API, then Boostmyshop uses the following PHP encoding function to make it work : urlencode(rawurlencode($sku))
For example, SKU "ABCD/E" would be transformed to "ABCD%252FE" to make the API call to Magento 2 work. Here the slash "/" is replaced by "%252F" to make the call work.
However, your Apache/Ngnix server must be configured properly to accept this encoding.
How to fix
Here are the different cases to check to ensure your server is properly configured:
1) Apache believes that's an invalid url
==> Add the following instruction in httpd.conf file : AllowEncodedSlashes On
2) Apache decodes the encoded slashes
==> Add the following instruction in httpd.conf file (Requires Apache 2.3.12+) : AllowEncodedSlashes NoDecode
3) "mod_proxy" attempts to re-encode (double encode) the URL
The result will be "mod_proxy" encoding again the already encoded slash "%2F" to "%252F".
==> In httpd.conf file, use the ProxyPass keyword nocanon to pass the raw URL through the proxy.
Example httpd.conf file:
AllowEncodedSlashes NoDecode
<Location /example/>
</Location>
Final check
To check if everything is working well after your changes, in myFulfillment go to menu Integrations > [Select your Magento 2 integration] > Tools tab.
There, you will find a "API debug" section containing a "Stock item" field.
In this field, enter the SKU you want to test (use a SKU containing a slash ("/") to check if your previous changes work) :
==> If product details are displayed, that means myFulfillment is well able to process call to your Magento 2 server for SKUs with slash(es).
If you still get the error message "Unable to find stock item ID for sku XXXXXX", that means your changes did not work.