Both sides previous revisionPrevious revisionNext revision | Previous revision |
v:2.0:javascript [2019/04/04 00:18] – [File Structure] adam | v:2.0:javascript [2023/04/04 14:07] (current) – [Available Events] adam |
---|
<script> | <script> |
var FC = FC || {}; | var FC = FC || {}; |
FC.onLoad = function () { | FC.onLoad = function() { |
FC.client.on('cart-submit', function(params, next) { | FC.client.on('cart-submit', function(params, next) { |
$element = $(params.element); | $element = $(params.element); |
* ''%%data-fc-id="minicart-order-total"%%'': The inner HTML will be replaced by the value in ''FC.json.total_price'', formatted using the ''_currency_format'' function (which adds decimals but doesn't add currency symbols). | * ''%%data-fc-id="minicart-order-total"%%'': The inner HTML will be replaced by the value in ''FC.json.total_price'', formatted using the ''_currency_format'' function (which adds decimals but doesn't add currency symbols). |
* ''%%data-fc-id="minicart-singular"%%'': The inner HTML will be shown if value in ''FC.json.item_count'' is equal to 1, and is hidden otherwise. It can be useful if you want to show "Item/Product" instead of "Items/Products" for ''FC.json.item_count'' = 1. | * ''%%data-fc-id="minicart-singular"%%'': The inner HTML will be shown if value in ''FC.json.item_count'' is equal to 1, and is hidden otherwise. It can be useful if you want to show "Item/Product" instead of "Items/Products" for ''FC.json.item_count'' = 1. |
* ''%%data-fc-id="minicart-singular"%%'': The inner HTML will be shown if value in ''FC.json.item_count'' is greater than 1 or less than 1 (zero), and is hidden otherwise. | * ''%%data-fc-id="minicart-plural"%%'': The inner HTML will be shown if value in ''FC.json.item_count'' is greater than 1 or less than 1 (zero), and is hidden otherwise. |
| |
| |
* ''cart-item-quantity-update'': When a quantity is changed in the cart | * ''cart-item-quantity-update'': When a quantity is changed in the cart |
* ''cart-item-remove'': When a quantity is removed from the cart | * ''cart-item-remove'': When a quantity is removed from the cart |
* ''cart-coupon-add'': When a coupon is added | * ''cart-coupon-add'': When a coupon or gift card is added |
* ''cart-coupon-remove'': When a coupon is removed | * ''cart-coupon-remove'': When a coupon is removed |
| * ''cart-gift-card-remove'': When a gift card is removed |
* ''cart-update'': Called when the cart is updated. Things like rendering Twig templates or setting the FC.json. | * ''cart-update'': Called when the cart is updated. Things like rendering Twig templates or setting the FC.json. |
* ''cart-shipping-options-update'': Called when the shipping options are updated | * ''cart-shipping-options-update'': Called when the shipping options are updated |