0

Im trying to create a custom module that handles values by store view level.

Anyway if the user does not select anything i want to get the default scope value at website level, im doing this in a multistore setup.

This is what i have already:

$data = $this->scopeConfig->getValue("payment/get_section/$section/$field");

Im getting the field with this set up at store view level because i think this is the default scope.

I have already tried by adding: ScopeInterface::SCOPE_WEBSITE but im still getting the same value as before, the store view value, any ideas?

1

you have used the right syntax. Make sure you use it with \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE and also make sure you add value after selecting specific website.

The reference image is shared below.

Selection of store or website

Let me know if this helps u.

Thank you.

  • Yes, looking at the db, there is only store scope, i dont see any value with website scope, is this correct? so i have sent the store id and i got the value updated...but i need to know the default website id, is this the correct code snipped? $websiteID = $this->_storeManager->getWebsite()->getId(); im always getting 1. – lucasvm1980 Nov 8 at 15:55
  • yes this is how you get the id. 1 means, you are getting default website id. make sure you are on other website for which you are looking value for – Ali Hussain Nov 8 at 16:58

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.