I'm trying to add new products to a Magento 2.1.7 and noticed some strange behaviours when it comest to global attributes (special_price for this example), found a workaround (kind of...) and was looking for a confirmation from the community if what I'm seeing in there is correct.

So, scenario: Magento 2.1.7 installation, only 1 store. The endpoint used is rest/V1/products/, but using it like that, although it assigns the product to the one store I have in the installation, it also creates a row in the catalog_product_entity_decimal table having store_id as 1, when a global attribute should have only 0 - is that correct?

Now, that attribute ends up in being a rogue row in there because no matter what I'm trying in the admin to do with it, being a global attribute, the admin's not touching that at all. The problem on the frontend after that is that the product in question will always show the special_price, because it finds an attribute with the current store_id, doesn't matter if it's global or not, it just shows it (now this is an assumption, haven't checked that, must admit, but it kinda makes sense).

If I am changing the endpoint to rest/all/V1/products/ it doesn not create the store_id=1 attribute in that table, but the product is not assigned to the store front either, and although now the special_price is not an issue anymore, I have to go in the admin for all products created like that and assign them to the only default website in order to be visible on the front-end.

Doing a bit more 'light reading' through http://devdocs.magento.com/swagger/index_20.html I found that I can follow up the initial API call when I create the product with the /all/ endpoint that eliminates the special_price problem with another call for rest/all/V1/products/webites with the following JSON payload:

    "productWebsiteLink": {
    "sku": "<newly-created-product-sku>",
    "websiteId": 1

It assignes the product to the only available website, shows in the front-end and all my problems are solved.

Now, the 'million dollars question': is this normal? Is that how it should be done? Create the product unassigned to a website and follow that up with another API call to assign it? If so, is there somewhere in the documentation that tells you the exact steps to follow?

The closest thing I could find about this problem (although it states it's about getting products) is this: https://github.com/magento/magento2/issues/8121 and I got there following Magento2: Save Product Data for global scope using Rest API

Any opinions/links/advice will be greatly appreciated.


1 Answer 1


Since no one answered I take it I was right, that's how it's supposed to work.

Well, not only that really, but the fact that everything seems stable and working properly after I advised the 3rd party company we were working with for this one to do it that way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.