Join Slack
Powered by
HI All, We Want to hide the addtocart button based...
# suitecommerce
g
Geetha
05/12/2021, 2:05 PM
HI All, We Want to hide the addtocart button based on condition,it's better to write the logic in template or any extending the template by writing the prototypes ...what is the better way to write?? Any one have any idea??
d
Denis Espinosa
05/12/2021, 2:53 PM
the best way is used cart component, listening beforeAddLine event.
https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/Cart.html#event:beforeAddLine
g
Geetha
05/12/2021, 2:54 PM
I want to perform the logic when page loads
d
Denis Espinosa
05/12/2021, 3:01 PM
other way is send a variable to template with addToViewContextDefinition to show add to cart view.
https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/Layout.html#addToViewContextDefinition
Denis Espinosa
05/12/2021, 3:03 PM
both solutions in mountToApp function in extension entry point
Denis Espinosa
05/12/2021, 3:04 PM
it is also recommended to do the validation on the server side
👍🏽 1
3
Views
Open in Slack
Previous
Next