I tried to add Home Page URL key programmatically using Recurring.php

Normally from Magento Admin backend:

STORES -> GENERAL -> Web -> Default Pages -> Default Web URL:

enter image description here

I tried using



namespace Vendor\Module\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;

class Recurring implements InstallSchemaInterface
    const default_web_url  = 'cms';
    protected $_configInterface;

     *  @var \Magento\Framework\App\Config\Storage\WriterInterface
    protected $configWriter;

     * @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
    public function __construct(
        \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
    ) {
         $this->configWriter = $configWriter;

    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
       $value = self::default_web_url;
       $this->configWriter->save('web/default/front',  $value, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeId = 0);


In my local, this value is storing for all store view scopes($scopeId = 0) but in our server, it's setting value for only one store view.

This is the issue I am facing here if anyone having any idea please guide me.

Thanks in Advance !!!!.


It seems like you didn't set sequence in module.xml file :

Replace this below code with your module.xml file

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <module name="VendorName_ModuleName" setup_version="1.0.0">
            <module name="Magento_Backend"/>

I checked your code and testing. Rest of all your code working.

Hope it maybe helpful for you.

  • Why downvoted? what's wrong in this? – Rohan Hapani Jul 29 '19 at 11:15
  • sorry i don't know how it's downvoted,may be by mistake it's done from my side or not but i don't wanted to do anything because even i don't have much clearity on this topic, i will appreaciate for your answer thanks for answers if it will work i will accept your answers. – Hitesh Balpande Jul 29 '19 at 11:20
  • Okay. No any issue :) Yes it will working. – Rohan Hapani Jul 29 '19 at 11:21
  • If possible then, remove entry of your module from setup_module table and then upgrade deploy. – Rohan Hapani Jul 29 '19 at 11:24
  • yes we can do upgrade deploy command but not able to delete any data from setup_module table. – Hitesh Balpande Jul 29 '19 at 11:27

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.