0

I've set up a Drupal Commerce store (on localhost) for a book shop. One of the requirements is that people can buy ebooks without creating an account.

It all works fine if I buy a book as the administrator; at the end of the checkout process I can download the book. However, when I buy a book as an anonymous user I'm shown the 'Download now' link in plain text.

I'm using a content type named 'Books' with a field named 'Ebooks'. The latter uses the 'File' field type. The rest of my set-up is as follows:

Commerce File 7.x-2.0-beta2:

  • Product types: Books
  • Download limits: 5

Commerce License 7.x-1.2

  • Product types: Books
  • Line item types: Product

Permissions for anonymous users:

  • Checkout, Access checkout
  • Commerce licenses, View own licenses
  • Order, View own orders of any type

Rules:

  • Create a new account for an anonymous order: inactive
  • Assign an anonymous order to a pre-existing user: inactive
  • Activates licenses of an order: Completing the checkout process > Activates all licenses of the provided order
  • Update the order status on checkout completion: Completing the checkout process > Update the order state (to 'Pending')

At first I though the issue was that the order status is changed to 'Pending' once the checkout process has completed. However, changing this made no difference.

I then found that giving anonymous users permission to 'bypass license control' does instantly resolve the issue. However, that permission setting comes with a "give to trusted roles only; this permission has security implications".

So... something is not quite right in my set-up. It seems that anonymous users aren't given a license allowing them to download their purchase. I've run out of ideas though. What have I done wrong?

1

You have disabled the rules for creating an account for the anonymous user. Therefore, the license never gets assigned to an actual user, stays assigned to user 0.

Commerce License and Commerce File were designed to license the file to an actual customer. I suggest either re-enabling the rules and creating the user accounts or developing a custom solution for the file downloads (you don't need most of commerce file if there's no actual user... just a temporary file link).

  • Thanks, that explains. Using a temporary file link would be the preferred solution - is there any documentation on how to set this up? – rkhff Jun 5 '14 at 18:41

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.