0

I'm using the membership entity module, and the membership entity commerce module.

I am trying to create a membership using rules, without success yet.

There is one membership action available..to activate the membership but thats all.

EDIT: This is the rule I used for checking out a membership:

    { "rules_at_listing_import_create_user_and_membership" : {
    "LABEL" : "At listing import create user and membership",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [
      "rules",
      "commerce_cart",
      "commerce_checkout",
      "membership_entity_commerce",
      "feeds"
    ],
    "ON" : { "feeds_import_listing_import" : [] },
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "user",
            "param_name" : "[node:field-first-name][node:field-last-name]",
            "param_mail" : [ "node:field-user-email" ]
          },
          "PROVIDE" : { "entity_created" : { "user_created" : "Created user" } }
        }
      },
      { "user_unblock" : { "account" : [ "user-created" ] } },
      { "entity_save" : { "data" : [ "user-created" ], "immediate" : "1" } },
      { "commerce_cart_product_add_by_sku" : {
          "USING" : {
            "user" : [ "user-created" ],
            "sku" : "Listingmember-1y",
            "quantity" : "1",
            "combine" : "1"
          },
          "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
        }
      },
      { "commerce_checkout_complete" : { "commerce_order" : [ "product-add-line-item:order" ] } },
      { "membership_entity_commerce_activate_term" : { "commerce_order" : [ "product-add-line-item:order" ] } }
    ]
  }
}

Using this rule, I assume that the membership is created automatically because of the membership product being checked out.

Alternatively, I tried the method without using the membership product, by straight away creating an entity of type membership using rules. That does not work, the membership is not created.

2
  • your rule has to do various save operations, and all this in a single rule. Unexpected things may happen (or not happen). At this point I'd enable Rules debugging (within "settings"), to see if any errors show up there. If you do, please add relevant rules logging info (shown near the top of the page) as an extra update to your question. Nov 8, 2017 at 20:31
  • @Pierre.Vriens No errors appear in the rules log or dblog. The ruls log shows: i.imgur.com/eAGCEfm.png (I did not expand the default commerce reactions).. Basically it doesn't show much info about a membership
    – Yuri
    Nov 8, 2017 at 22:45

1 Answer 1

0

I did a good comparison of the Commerce membership entity module and the Commerce Licenses module, and the commerce licences can do te same, and has a lot more extra features, is more flexible. So switching to that module was my solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.