Blog Sections Open

Fixing Shopkeeper JavaScript Errors Around .shk-item Containers

A practical fix for Shopkeeper product cards that look correct but fail at add-to-cart time because the expected container structure is missing.

Shopkeeper JavaScript can fail even when the HTML looks almost right. One common reason is that the markup no longer matches the structure the script expects for add-to-cart positioning and animation.

Typical setup

[!Shopkeeper? &orderFormPage=`28` &changePrice=`1` &stuffCont=`div.shk-item` &cartType=`small` &flyToCart=`helper` &noJQuery=`1`!]

The product card then wraps the form in a div.shk-item. If that wrapper is missing or restructured unexpectedly, Shopkeeper may fail with an error like:

cannot read property offsetLeft of undefined

What this usually means

The JavaScript is trying to measure an element that no longer exists at the selector path it expects. That can happen after custom template changes, nested wrappers, or script-loading order problems.

Checklist

  • Confirm that every product card still has the expected .shk-item wrapper.
  • Check whether jQuery is available before Shopkeeper runs.
  • Verify that the cart helper and product form are rendered in the same DOM structure Shopkeeper expects.
  • Test with the simplest stock product template before restoring custom markup.

In most cases this is a template-structure problem, not a core Shopkeeper bug. Restore the expected container logic first, then reintroduce custom HTML carefully.

Newer post

Breaking a Ditto News Feed to Insert a Banner or Promo Block

How to split a Ditto news stream at a chosen position so a banner or promotional block can be inserted without rewriting the whole listing.

Older post

Restricting Frontend Resources by Web User Group in Evolution CMS

How to protect frontend resources in Evolution CMS by assigning them to web user groups instead of relying only on template logic.