Skip to content

Continue Shopping

Continue Shopping extension allows continue shopping buttons to link to the users previously viewed product by using a CSS class.

Installation

  1. Add the following to your Global.js file:

    import ContinueShopping from 'extensions/continue-shopping';
    

  2. Initialize Continue Shopping Link in your Global.js file:

    new ContinueShopping();
    

  3. Add the following class .js-continue-shopping to your Continue Shopping / Start Shopping button. This will take user to last viewed product.

    <a class="g-button-primary js-continue-shopping" href="&mvte:urls:SFNT:auto;">Start Shopping</a>
    

Configuration Options

The following table defines the available configuration options:

Name Type Description Default Value
links ElementList or String An ElementList or string-selector to indicate the links that you would like to be triggers for this continue shopping functionality. .js-continue-shopping
screens Array An array of Strings that match window.mivaJS.Screen values. If the user is on one of the screens, it will be saved in session storage and be set as the continue shopping url. ['CTGY', 'PLST', 'PROD', 'SRCH']

Example Usage

.js

import ContinueShopping from 'extensions/continue-shopping';

// With defaults...
new ContinueShopping();

// or with overrides and `links` as a `String`
new ContinueShopping({
    links: 'a.g-button-primary',
    screens: [
        'CTGY',
        'SRCH'
    ]
});

// or with `links` as an `ElementList`
new ContinueShopping({
    links: document.querySelectorAll('a.g-button-primary')
});

.mvt

<div class="g-layout">
    <div class="g-layout__item">
        <div class="g-messages g-messages--info">
            <strong>Your shopping cart is currently empty.</strong><br>
        </div>
        <a class="g-button-primary js-continue-shopping" href="&mvte:urls:SFNT:auto;">Start Shopping</a>
    </div>
</div>