0

I am using Drupal commerce 2 with Drupal 9. I added few products and I need to access their revisions, but there is no revision option for products in Drupal commerce.

How can I enable revisions for a product?

4
  • There this open issue Add revision support to products.
    – leymannx
    Commented Jun 3, 2021 at 6:19
  • Thank you for your response. I have tried this patch and it is not working. After implementing this patch "commerce-add_product_revision-2656896-42.patch", there is no option coming to view product revisions in the Drupal admin.
    – GSuri
    Commented Jun 4, 2021 at 8:15
  • Please don't tell this here. Please add your feedback and any other question you have to to this issue instead.
    – leymannx
    Commented Jun 4, 2021 at 10:33
  • Sure. Thank you.
    – GSuri
    Commented Jun 8, 2021 at 1:58

1 Answer 1

2

As of today, the answer is "You can't." The rationale is that the kinds of things people tended to do with revisions weren't really best solved by revisions within Drupal. Consider, for example, the challenges of representing referenced entities in other contexts (i.e. rendering a product title to an order page). There is no reference relationship that would ensure the appropriate revision of the product is loaded in the future, meaning what an order page shows may change over time accidentally / inappropriately.

While a patch is in progress for this (linked above in the comments), you should consider whether you really need revisions. If you merely want to log changes made to a product, you might consider some other mechanism instead.

3
  • Thank you Ryan for your comment. I really need product revisions. I need a provision where I can revert to the previous product revision. Earlier we used to have this facility in Ubercart in Drupal 6 but with Drupal commerce in Drupal 9, I am still exploring and looking forward to having this feature soon. As you suggested, I have checked other ways also, log changes made to the product won't give you an option to revert to that previous version. Any help would be appreciated. Thank you.
    – GSuri
    Commented Jun 8, 2021 at 8:06
  • Got it. Yeah, revisions are the classic "revert changes made to this entity" thing, but bear in mind that in order to properly revert you'd need synchronized revisions on every related entity. For example, imagine reverting to a prior version of the product that referenced a taxonomy term that has since been deleted. It wouldn't work - you simply can't go back and undelete that data. For products, this also includes every referenced product variation, their referenced attribute values, and more. In short ... it's gonna be a lot of work to try to make it happen yourself. 😬 Commented Jun 9, 2021 at 19:22
  • Thank you for your valuable feedback. I hope the patchwork is in progress and it will help to implement product revisions soon. This is a really important feature and should be there by default in Drupal commerce. It will be helpful just in case if admin user wants to review previous years changes in the product or just incase want to revert to the previous revision without deleting any taxonomy term. I have seen few examples where there was a requirement to go back to 2 previous revisions and that was doable in Ubercart. I hope it will be introduced soon in Drupal Commerce as well. Cheers.
    – GSuri
    Commented Jun 11, 2021 at 8:03

Your Answer

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

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