Greetings,

I am running into an issue when attempting to import products from a csv file to Drupal 8 Commerce.

I get the error:

Missing bundle for entity type commerce_product                                [error]
(/var/www/html/drupal/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:74)

I have tried setting type and bundle in the process section of the yml file as well as provide a default bundle in the destination part.

Example:

source:
 ...
 constants:
    bool_0: 0
    bool_1: 1
    uid_root: 1
    restricted_html: restricted_html
    product_type: custom_product_type
destination:
  plugin: 'entity:commerce_product'
  destination_module: commerce_product
  default_bundle: custom_product_type
process:
  product_id: ID
  type: constants/product_type

Nothing seems to be working, I get the same error no matter. If I just include a single value in here or a default value or... anything really.

Any help is much appreciated.

Thank you!

Comments

dobe created an issue. See original summary.

quietone’s picture

Hi dobe, the snippet looks mostly fine. The indentation for the constant values is has an extra space, maybe that is a copy/paste error, but worth checking.

Let's start with the basics, does the commerce product type custom_product_type exist and is machine name correct? Perhaps a later process is altering the 'type' source property? Can you share more of the migration.yml?

Have any product variations for custom_product_type been migrated? Are variations included in this product migration? In commerce_migrate we settled on doing the product_variations first and then the products.

dobe’s picture

Hi @quietone, thank you for your comments.

Yeah that is a copy/paste error for the constants.

Commerce product type exists and has nothing imported / nothing is in the system for that type of product yet.

I haven't tried doing the commerce product variations first. I currently have a plugin that goes and runs a migration for that variation.

variations/target_id:
  -
    plugin: migration_lookup
    migration: custom_product_variation
    source: product_variations

But I don't even think it gets to this point yet. All my taxonomy is getting created that is on the product.

What I find interesting is that when I go and log the values that are coming into ContentEntityStorageBase.php type is not present. No matter how I try to include type into the process it does not make it to that Class. Any ideas here?

-Jesse

quietone’s picture

Hi Jesse,
Nothing come to mind at the moment, but I am just about to leave. You could ask on Drupal Slack in #migration, https://drupal.slack.com.

dobe’s picture

Status: Active » Closed (works as designed)

Was able to fix this by re importing my yml config.

vindesh’s picture

Hi ,

same problem getting with commerce after update drupal 8.8.9 version with latest version of drupal 8.9.13 version.

Commerce >> Products >> Add >> Standard

Drupal\Core\Entity\EntityStorageException: Missing entity bundle. The "default" bundle does not exist in Drupal\Core\Entity\ContentEntityStorageBase->createWithSampleValues() (regel 150 van /var/web/vd12364/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

If anyone have solution please let me know.

Thanks

vinodhinisureshbabu’s picture

Exporting the current configuration and removing the deleted entities with depended yml files , and reimporting again which resolved the issue