I am showing cross-selling products at the bottom of the product page. I want that when user clicks on Add To Cart button page should scroll to the bottom.
I added a anchor tag at the point where I want to scroll the page to.
Then in events.js I am trying to do something like this:
import wixStoresBackend from 'wix-stores-backend';
export function wixStores_onCartCreated(event) {
//let total = event.totals.total;
console.log('HERE');
$w('#ancprod').scrollTo();
}
From above code base I expect is when ever I add a product in cart this event would trigger and scroll page to the anchor point in the page.
But when I am adding the product to cart by Clicking Add To Cart nothing happens page does not scroll.
I have checked in site monitoring I can see my console.log message so which proves that OncartCreated is getting fired.
Any suggestions please on how to get it working?