Sanchit Khera
Sanchit Khera

Reputation: 1005

Hybris - Deleting product from everywhere

We have a requirement to delete certain products from everywhere in hybris (including cart, orders, promotions) and all its references as well like Media, Category, Stocks, etc.

I found this one solution:

REMOVE Product [batchmode=true];itemType(code)[unique=true]
 ;Product;

I was wondering if just deleting the product, would remove all its references from hybris, or is there any better solution to do this.

Any help is greatly appreciated!

Upvotes: 2

Views: 4909

Answers (2)

Mark Patel
Mark Patel

Reputation: 21

Removing product will remove only instances of product type, but not all data like media.

To remove from cart : it should inform user that product no longer available in store

For successfully placed orders : you should be able to display basic details of product with message as in cart [ :) :) But you should deliver if order is placed successfully and payment is received otherwise its a bad eCommerce impression]

For promotions : you should remove all promotions related to this product Or reconfigure according to business need.

Upvotes: 0

Christian Strempfer
Christian Strempfer

Reputation: 7383

Removing the product will remove references to it, but not the objects which are refering to it (like Media, Category, Stocks, etc.)

The only objects which will be deleted are those refered by attributes with the partOf modifier.

A Part Of relationship between two classes extends an aggregation relationship by ensuring that the lifecycle of the dependant object (the part) is bound to the lifecycle of the parent object. When you delete the parent object, all instances of its attribute types that are marked as partOf will then be cascade-deleted.

Hybris doesn't know if a Media or a Category is no longer needed after a Product is removed. Therefore you must delete those objects explicitly.

Upvotes: 2

Related Questions