1

How can I change the machine name of product type (in drupal commerce ) after it created and has several content , as example I has tv porduct type I want to change it to LCDTV , How can I change it?

2

You can alter the machine name through the database to change the product type. See table commerce_product_type and alter the 'type' column.

Make proper adjustments in commerce_product for products using the old type. You could execute something like the following SQL query

UPDATE commerce_product SET type = REPLACE(type, "tv", "lcdtv");

Be sure to test this on a local or development version of the site.

UPDATE: As mentioned by Clive, you also have to update field data/revision tables.

You'd want to run UPDATE field_table_name SET bundle = REPLACE(bundle, "tv", "lcdtv"); on any field_data_* or field_revision_* table that relates to your product type.

  • and thoroughly clear all caches related, of course. – Mołot Apr 17 '14 at 14:36
  • 2
    It really isn't that simple - you'll also need to update the bundle in all field data/revision tables, for example – Clive Apr 17 '14 at 14:58
  • 1
    @Clive is correct. You'd also have to update related field_data_* and field_revision_* tables. Answer updated appropriately. – Matt Glaman Apr 17 '14 at 15:55

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.