File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -639,16 +639,18 @@ define(
639
639
var isStarted = false ;
640
640
641
641
// Capture active redirect URL with IS facet params for add to cart from PLP
642
- search . on ( 'render' , ( ) => {
643
- const cartForms = document . querySelectorAll ( '[data-role="tocart-form"]' ) ;
644
- cartForms . forEach ( ( form , i ) => {
645
- const ts = Date . now ( ) ;
646
- form . addEventListener ( 'submit' , e => {
647
- const url = `${ algoliaConfig . request . url } ${ window . location . search } ` ;
648
- e . target . elements [ algoliaConfig . instant . addToCartParams . redirectUrlParam ] . value = AlgoliaBase64 . mageEncode ( url ) ;
649
- } )
650
- } ) ;
651
- } ) ;
642
+ if ( algoliaConfig . instant . isAddToCartEnabled ) {
643
+ search . on ( 'render' , ( ) => {
644
+ const cartForms = document . querySelectorAll ( '[data-role="tocart-form"]' ) ;
645
+ cartForms . forEach ( ( form , i ) => {
646
+ const ts = Date . now ( ) ;
647
+ form . addEventListener ( 'submit' , e => {
648
+ const url = `${ algoliaConfig . request . url } ${ window . location . search } ` ;
649
+ e . target . elements [ algoliaConfig . instant . addToCartParams . redirectUrlParam ] . value = AlgoliaBase64 . mageEncode ( url ) ;
650
+ } )
651
+ } ) ;
652
+ } ) ;
653
+ }
652
654
653
655
function startInstantSearch ( ) {
654
656
if ( isStarted === true ) {
You can’t perform that action at this time.
0 commit comments