public static function createBlocks() {
    $block = Block::create([
      'id' => 'presto_theme_views_block__presto_product_listing_listing_block',
      'status' => TRUE,
      'plugin' => 'views_block:presto_product_listing-listing_block',
      'weight' => 10,
      'theme' => 'presto_theme',
      'region' => 'content',
      'visibility' => [
        'request_path' => [
          'id' => 'request_path',
          'pages' => '/products',
          'negate' => FALSE,
          'context_mapping' => [],
        ],
      ],
    ]);
    $block->save();

    $block = Block::create([
      'id' => 'presto_theme_cart',
      'status' => TRUE,
      'plugin' => 'commerce_cart',
      'weight' => 30,
      'theme' => 'presto_theme',
      'region' => 'navigation_collapsible',
      'visibility' => [],
      'settings' => [
        'id' => 'commerce_cart',
        'label' => 'Cart',
        'provider' => 'commerce_cart',
        'label_display' => '0',
        'dropdown' => 'false',
      ],
    ]);
    $block->save();
  }
public static function createBlocks() {
    $block = Block::create([
      'id' => 'presto_theme_views_block__presto_product_listing_listing_block',
      'status' => TRUE,
      'plugin' => 'views_block:presto_product_listing-listing_block',
      'weight' => 10,
      'theme' => 'presto_theme',
      'region' => 'content',
      'visibility' => [
        'request_path' => [
          'id' => 'request_path',
          'pages' => '/products',
          'negate' => FALSE,
          'context_mapping' => [],
        ],
      ],
    ]);
    $block->save();

    $block = Block::create([
      'id' => 'presto_theme_cart',
      'status' => TRUE,
      'plugin' => 'commerce_cart',
      'weight' => 30,
      'theme' => 'presto_theme',
      'region' => 'navigation_collapsible',
      'visibility' => [],
      'settings' => [
        'id' => 'commerce_cart',
        'label' => 'Cart',
        'provider' => 'commerce_cart',
        'label_display' => '0',
        'dropdown' => 'false',
      ],
    ]);
    $block->save();
  }
public static function createBlocks ( ) { $ block = Block :: create ( [ 'id' => 'presto_theme_views_block__presto_product_listing_listing_block' , 'status' => TRUE , 'plugin' => 'views_block:presto_product_listing-listing_block' , 'weight' => 10 , 'theme' => 'presto_theme' , 'region' => 'content' , 'visibility' => [ 'request_path' => [ 'id' => 'request_path' , 'pages' => '/products' , 'negate' => FALSE , 'context_mapping' => [ ] , ] , ] , ] ) ; $ block -> save ( ) ; $ block = Block :: create ( [ 'id' => 'presto_theme_cart' , 'status' => TRUE , 'plugin' => 'commerce_cart' , 'weight' => 30 , 'theme' => 'presto_theme' , 'region' => 'navigation_collapsible' , 'visibility' => [ ] , 'settings' => [ 'id' => 'commerce_cart' , 'label' => 'Cart' , 'provider' => 'commerce_cart' , 'label_display' => '0' , 'dropdown' => 'false' , ] , ] ) ; $ block -> save ( ) ; }
Create block.

We do a manual entity create as for some reason it won't import via config.

@throws \Drupal\Core\Entity\EntityStorageException
Create block .