I'd assume that flatrate shipping methods are configuration and thus can be managed via features - however they are just stored into the database and not managable like config at all.

Maybe we could just convert them to exportable entities from the entity api? This would take care of the right now manually implemented crud hooks and give as features support as well as a default hook (as asked for in other issues). Also, it would help with i18n integration.


bojanz’s picture

That would be really smart (flat rates as exportable entities).
It would also allow us to use the inline_conditions module to provide a UI for when a flat rate should apply.

dasjo’s picture

in the meantime, you can use this install task for one-time initialization.

 * Implements hook_install().
function myshop_install() {
  $service = array_merge(
      'name' => 'myshop_flat_rate',
      'title' => 'My Shop Flat rate',
      'display_title' => 'My Shop Flat rate',
      'description' => 'Default flat rate for My Shop.',
  // Will be divided by 100.
  $service['base_rate']['amount'] = '800';
  // The strongarm variable doesn't seem to be initialized properly at this stage.
  $service['base_rate']['currency_code'] = 'EUR';
dasjo’s picture

also see [#6591174-8]

fox mulder’s picture

Issue summary: View changes

Hi all!

I don't understand everything from this thread (my english is pure), but I have same issue than described in issue title. The flat rate services are exportable with Features, but the rule components are not, because the component name of a flat rate service look like this: commerce_shipping_service_SERVICE_NAME, but the feature creation procedure puts this line in MYFEATURE.info: features[rules_config][] = commerce_flat_rate_services_SERVICE_NAME

commerce_flat_rate_services_SERVICE_NAME named rule component does not exist and MYFEATURE.rules_defaults.inc does not contain $item['commerce_flat_rate_services_SERVICE_NAME'].

I don't understand the way of this mechanism, maybe my problem is Features/Commerce shipping/Commerce related

fox mulder’s picture

I think this patch solves this problem: https://www.drupal.org/node/1402762#comment-6591174

I'm using commerce kickstart and it contains the previous version of this patch: https://www.drupal.org/node/1402762#comment-5985864 or something similar...

das-peter’s picture

Adding related ticket.

das-peter’s picture

rszrama’s picture

Title: Flatrates cannot be exported using Features » Allow flat rate services to be exported using Features
Category: Bug report » Feature request
Status: Active » Postponed (maintainer needs more info)

I just had a project recently where I exported flat rate services just fine via the Commerce Features module. Am I missing something?