Description:
This article explains how to hide a specific item (such as a “Processing Fee” non-inventory line) from the cart item list view in SuiteCommerce (SCA). This is useful when certain line items must remain in the cart for calculation purposes (e.g., totals, tax), but should not be displayed to the customer on the cart page.
This technique uses a childViews override in CartDetailedView to filter out unwanted items from the Backbone collection passed to the cart line item list view.
✅ Solution
📍 Objective:
Remove a specific item (e.g., internal ID 5045 for “Processing Fee”) from the cart item list rendering without removing it from the cart model.
🔧 Implementation Steps:
1. Determine the Internal ID
Identify the internal ID of the item to hide (e.g., from SuiteScript or logs).
Plain Text
javascriptCopyconst PROCESSING_FEE_ITEM_ID = 5045;
2. Override Cart.Item.List in CartDetailedView.childViews
Inside your SuiteCommerce extension (e.g., in mountToApp or view override), use the following code:
Plain Text
javascriptCopy_.extend(CartDetailedView.prototype.childViews, {
'Cart.Item.List': function () {
console.log('[Cart.Item.List] Rendering filtered collection');
const processingFeeItemId = 5045;
const originalLines = this.model.get('lines').models || [];
// Filter out the line where item.internalid === 5045const filteredLines = originalLines.filter(function (line) {
const item = line.get('item');
return item && item.get('internalid') !== processingFeeItemId;
});
return new BackboneCollectionView({
collection: filteredLines,
viewsPerRow: 1,
childView: CartLinesView,
childViewOptions: {
navigable: !this.standalone,
application: this.application,
SummaryView: CartItemSummaryView,
ActionsView: CartItemActionsView,
showAlert: false }
});
}
});
3. Rebuild and Deploy the Extension
Use:
Plain Text
bashCopygulp extension:local # orgulp extension:deploy
Then test the cart page in SuiteCommerce.
✅ Expected Outcome:
- The Processing Fee item (or any item with the specified internal ID) is no longer displayed on the cart item list.
- The item remains in the cart model and is still counted in totals, taxes, and order summary.
- Performance is improved by skipping the rendering of the unnecessary line view.
🧠 Notes:
- This logic only affects visual rendering, not the backend or order submission.
- If you need to hide items from checkout or confirmation pages, the same approach applies to views like
OrderWizardStepReview,OrderConfirmationView, etc. - This method works well for hiding “service fee”, “gift wrap”, “free gift”, and other virtual items.