Magento 2: getting error for all pages We can't create the Wish List right now

php bin/magento setup:upgrade

 Undefined index: wishlist in /var/www/html/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 152

display error on frontend

We can't create the Wish List right now.

Solutions

In the core file,

vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php

In the below condition add a if condition and execute the upgrade command.

After executing create the wishlist table and remove the condition. And execute other commands to ensure it is working fine.

/**
  * Process references for all tables. Schema validation required.
  *
  * @param  Table[] $tables
  * @param Schema $schema
  */
  private function processReferenceKeys(array $tables, Schema $schema)
  {
      foreach ($tables as $table) {
          $tableName = $table->getName();
          if ($schema->getTableByName($tableName) instanceof Table) {
              continue;
          }
          $referencesData = $this->dbSchemaReader->readReferences($tableName, $table->getResource());
          $references = [];

          foreach ($referencesData as $referenceData) {
              //Prepare reference data
              if($tableName != 'wishlist') {
                  $referenceData['table'] = $table;
                  $referenceTableName = $referenceData['referenceTable'];
                  $referenceData['column'] = $table->getColumnByName($referenceData['column']);
                  $referenceData['referenceTable'] = $this->tables[$referenceTableName];
                  $referenceData['referenceColumn'] = $referenceData['referenceTable']->getColumnByName(
                      $referenceData['referenceColumn']
                  );
                  $references[$referenceData['name']] = $this->elementFactory->create('foreign', $referenceData);
                  //We need to instantiate tables in order of references tree
                  if (isset($tables[$referenceTableName]) && $referenceTableName !== $tableName) {
                    $this->processReferenceKeys([$referenceTableName => $tables[$referenceTableName]], $schema);
                      unset($tables[$referenceTableName]);
                  }
              }
            }

            $table->addConstraints($references);
            $schema->addTable($table);
        }
    }
Tags: Magento 2.x

Similar questions

create mini wish list icon like mini cart
I am in requirement to add mini wish-list icon like mini cart count on top of header .I do not know this is Magento default functionality or Not.
How can i set wish list for guest user also in magento 2?
i need set Wishlist for guest users also can any one guide me how can i do this.
How can I display the "Add to wish list" button on products' slider?
I have this phtml file with the following code : This code displays a slider with products . How can I add to each product the Add to wish list button ? I have added wishlist.phtml, but still it doesn't work
Magento 2.0.2 Upgrade: Sorry, we can't take that action right now
I get this message when I try to upgrade my Magento 2.0.2 Sorry, we can't take that action right now.
Magento2: Product created from front-end is not adding to cart,it results "We can't add this item to your shopping cart right now."
However the sample products are adding in cart,this is problem with products that has been added programmatically. Below is the code I am using to create the product programmatically.
We can't add this item to your shopping cart right now on detail page
If someone want to add a product to the cart from the list view it works fine. But from a product detail page the Error appears: We can't add this item to your shopping cart right now.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.