Search code examples
sap-commerce-cloudimpex

Remove action from Hybris CMS component using Impex


I'm currently experimenting with Hybris in preparation for a project and I have some trouble making Impex do what I want to do.

The example electronics store defines the CMS actions for the ProductAddToCartComponent

INSERT_UPDATE ProductAddToCartComponent;$contentCV[unique=true];uid[unique=true];name;actions(&actionRef);&componentRef
;;AddToCart;Product Add To Cart;AddToCartAction,PickUpInStoreAction,ShareOnSocialNetworkAction;AddToCart

My goal is to remove the ShareOnSocialNetworkAction from the AddToCart element. I've tried several variations of REMOVE, which mostly resulted in the AddToCart element itself being deleted, as well as INSERT_UPDATE with only the actions I wanted to retain, which didn't have any effect at all.

How can I remove only the ShareOnSocialNetworkAction from the AddToCart component?


Solution

  • Have you tried INSERT_UPDATE with replace mode with adding all the actions but the one you want to remove ? :

    UPDATE ProductAddToCartComponent;$contentCV[unique=true];uid[unique=true];actions(uid,$contentCV)[mode = replace];
                                           ;;AddToCart;AddToCartAction,PickUpInStoreAction;
    

    Or using remove mode this way :

    UPDATE ProductAddToCartComponent;$contentCV[unique=true];uid[unique=true];actions(uid,$contentCV)[mode = remove];
                                    ;;AddToCart;ShareOnSocialNetworkAction;
    

    Hope this helps