Ecommerce for Statamic

Add to cart errors

When you try to add a product to your cart, Bison will check that it’s in stock. If it’s not, you’ll want to show an error.

Variable Pairs

stock_errors
Makes error variables available to you related to stock.

Variables

quantity
The quantity that the user has attempted to add.
product
The title of the product that the user attempted to add.
stock
The stock level of the product.
difference
The amount the user needs to reduce their quantity by the be able to add successfully.

Example

{{ bison:add_to_cart_errors }}
  {{ stock_errors }}
    <p>You tried to add {{ quantity }} of {{ product }} to your cart, but we only have {{ stock }}.
    Please reduce your quantity by at least {{ difference }}.</p>
  {{ /stock_errors }}
{{ /bison:add_to_cart_errors }}


Problem with this page? Edit it on Github.