0
votes

We have problems with features disabling. When we use approach from documentation and disabling saveForLater feature features: {saveForLater: false} it means that SelectiveCart service should not be working, or I'm wrong here? Is there a proper way how to disable this service/feature? We need to avoid additional calls which spartacus makes with url: selectivecart${activeBaseSite}${this.customerId}

1

1 Answers

2
votes

This feature flag does not affect the SelectiveCartService in any way. I guess this is intended behavior as you might want to use this service somewhere else. This flag only affects the UI - e.g. it prevents from rendering the "Save for later" button.

I presume that you're using the demo instance or Spartacus sample data. This sample data contains a SaveForLaterComponent in the TopContent slot on a cart page.

{
     "slotId" : "TopContent-cartPage",
     "slotUuid" : "eyJpdGVtSWQiOiJUb3BDb250ZW50LWNhcnRQYWdlIiwiY2F0YWxvZ0lkIjoiZWxlY3Ryb25pY3Mtc3BhQ29udGVudENhdGFsb2ciLCJjYXRhbG9nVmVyc2lvbiI6Ik9ubGluZSJ9",
     "position" : "TopContent",
     "name" : "Top Slot for Cart Page",
     "slotShared" : false,
     "components" : {
        "component" : [ {
           "uid" : "CartComponent",
           "uuid" : "eyJpdGVtSWQiOiJDYXJ0Q29tcG9uZW50IiwiY2F0YWxvZ0lkIjoiZWxlY3Ryb25pY3Mtc3BhQ29udGVudENhdGFsb2ciLCJjYXRhbG9nVmVyc2lvbiI6Ik9ubGluZSJ9",
           "typeCode" : "CMSFlexComponent",
           "modifiedTime" : "2020-04-23T21:36:55.684Z",
           "name" : "Cart Display Component",
           "container" : "false",
           "flexType" : "CartComponent"
        }, {
           "uid" : "SaveForLaterComponent",
           "uuid" : "eyJpdGVtSWQiOiJTYXZlRm9yTGF0ZXJDb21wb25lbnQiLCJjYXRhbG9nSWQiOiJlbGVjdHJvbmljcy1zcGFDb250ZW50Q2F0YWxvZyIsImNhdGFsb2dWZXJzaW9uIjoiT25saW5lIn0=",
           "typeCode" : "CMSFlexComponent",
           "modifiedTime" : "2020-04-23T21:36:55.717Z",
           "name" : "SaveForLater Component",
           "container" : "false",
           "flexType" : "SaveForLaterComponent"
        } ]
}

This configuration makes Spartacus render the SaveForLaterComponent which calls the SelectiveCartService. The component itself doesn't check the feature flags.

So the simple solution is to remove this component from the cart page in the CMS.

I hope this helps ;)