I am having trouble deciding how to tackle this problem. I have two products (indeed, one could be made as an attribute of another, which may help) which are basically two ticket options, only one of which can be purchased by a customer. Therefore I would like to display them as two radio buttons with a single add to cart button (which I would then configure with Rules to send them straight to checkout).

Right now I have this:

Right now I have this:

Again, I would like to basically have two buttons, only one of which can be selected, with a single Add to Cart form.

Any ideas?


Drupal commerce was designed to do exactly this without going through lots of hoops, but it might be a bit tricky to get into.

Instead of making one an argument of another I'd create one product display with two different attached products, for which you can set an attribute field and a price. You can do so by having a node content type to act as a 'product display'. To do so you require inline_entity_form and commerce_product_reference (part of the commerce package).

  • On the product-type add a field the distinguish 'premium' product and make sure to hit the 'Enable this field to function as an attribute' checkbox.
  • Add a product reference field to a (new) content type you call 'product display' (or if you plan on selling more different kinds of products you can use a more specific name line 'event ticket' or something).
  • For the field widget choose 'inline entity form (multiple)'.
  • Create a node of the 'product'-type and add the two different products and their properties; for the 'premium' product make sure to change the price and the attibute field we created earlier.
  • Save the node.

If all went well you should end up with a selection box on the 'product display' node, allowing the users to select which version of the product they want to buy.

If you find this too vague, there is a detailed explanation (with pictures) on it here: Product Attributes & Variations. It does not use inline entity form so the 'attach products' involves a drop down on the images, whereas inline entity form will allow you to create and edit the entities directly on the node.

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.