Skip to content

Latest commit

 

History

History

Cart Page Observe Changes

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Cart Page Observe Changes

Synopsis

Observe cart page changes.

Version

  • 0.2.2

SS Versions

  • 7.1

  • 7.0

v7.1 Fluid Engine Compatible

  • Not Applicable

Dependencies


Quick Install

  • Add code from file cart page observe changes.html to Website > Pages > Website Tools > Code Injection > FOOTER. Please see Add code to code injection. Read the code for any instructions within.

  • Add your custom callback names to the code. Your callbacks must be installed before the code.

Example Callbacks

Following are example callbacks. They don't do anything except log to the console nodes that were added or removed to/from the cart page. Note the use of var.

<script>

  var cpocNodeAddedLog = ( node ) => {
  
    console.log ( 'cpocNodeAddedLog : ', node );
    
    };
    
  </script>
<script>

  var cpocNodeRemovedLog = ( node ) => {
  
    console.log ( 'cpocNodeRemovedLog : ', node );
    
    };
    
  </script>

In your callbacks you will probably want to check the node to see if it is one in which you are interested. For example.

<script>

  var cartContinaerLog = ( node ) => {
  
    const b = node.querySelector === undefined;
    
    if ( b ) return; // bail if no querySelector
    
    const selector = '.cart-container';
    
    node = node
    
      .querySelector ( selector );
      
    if ( node === null ) return; // bail if no cart container
    
    console.log ( 'cartContinaerLog : ', node );
    
    };
    
  </script>

Make a Donation

Please consider making a donation.

Changes

  • 2024-05-01

    • improve error reporting
    • bumped version to 0.2.2
  • 2024-04-29

    • define callbacks as strings
    • bumped version to 0.2.1
  • 2024-04-28

    • improved handling of nodes
    • removed dependency on jQuery
    • bumped version to 0.2.0
  • 2022-02-25

    • changed a const name, no functional changes
    • added example callback to read me
    • bumped version to 0.1d1
  • 2022-01-16

    • initial version