2

I've already got products and stock updates going back and forth via the JSON API, and I'm now working on orders and prices for each store view - each one has a different currency, therefore different price values.

To push prices, I call rest/V1/products/tier-prices and specify:

{
  "prices": [
    {
      "price": 11,
      "price_type": "fixed",
      "sku": "sku_goes_here",
      "website_id": ???,
      "customer_group": "all groups",
      "quantity": 1
     }
  ]
}

But, I don't know what the website_id is. I load products etc. using the URL store view like rest/store2view/V1/products. This is a mandatory field.

I can get the website_ids for each item, but this is just a list of numbers, with no link back to which view they are.

How do I convert the store2view name into a website ID?

0

Each Magento installation has website ids and store ids. Tier prices are scoped per website so you will need a website id to store them. You can retrieve the list of your websites with a GET on /V1/store/websites

You can also find them in de database table under store_website. If you only use 1 website it normally had id 1. If it is for an extension you need to rely on the fact that one might have more then 1 website on their Magento installation.

  • Yes, thanks, I literally found this just this minute! – KolonUK Feb 25 at 16:28
  • For all futher references. You can just search the magento directories for all the webapi.xml and find all the possible paths like that. Glad you found it! If you enjoyed this answer please mark it as answer – CompactCode Feb 25 at 16:29
  • For example i know this is from the Magento module Magento_Stores. So i just went into the etc/webapi.xml fille and looked for all the possible paths. They are linked to a php interface with a function. – CompactCode Feb 25 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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