3

I am using Rooms and Commerce together as a booking system. One thing that bothers me is that it's possible for a customer to book let's say 50 pairs of roller skates, but Commerce will render each pair of roller skates as its own line item, which becomes insane as you have a long list of roller skate bookings when it could just print 50 x Roller Skates instead. Is there a way to force Rooms to recognize that items of the same unit type should be counted as several instances of one booking instead of several separate bookings?

Alternatively, does someone have a better idea of creating an equipment booking system that has checkout and payment integration? I also need the possibility to give discounts for multi-day bookings.

0

When editing the field display formatter for the product reference, there is an option you can select to combine like products in the cart:

Commerce product reference display configuration

If that's selected, then you can dig a bit deeper by looking at commerce_cart_product_add(). The logic to reckon a combination starts about a third of the function down. The biggest thing here is the comparison properties. Commerce uses at least two fields initially to determine if a product is a "like product": type and commerce_product. Then, it will add any fields that are exposed to the add to cart form, and finally you can then view or alter these fields by using hook_commerce_cart_product_comparison_properties_alter().

Effectively, it won't allow any products to be combined that do not sure the same SKU or unique properties that identify it.

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.