The following are common methods you will want to call in your front end templates:
To get the Craft Commerce general settings model:
{% set settings = craft.commerce.settings %}
See craft.products
See craft.orders
Returns an array of Country Models.
<select>
{% for country in craft.commerce.countries %}
<option value="{{ country.id }}">{{ country.name }}</option>
{% endfor %}
</select>
Returns a list usable for a dropdown select box.
Data returned as [32:'Australia', 72:'USA']
<select>
{% for id, countryName in craft.commerce.countriesList %}
<option value="{{ id }}">{{ countryName }}</option>
{% endfor %}
</select>
Returns an array of State Models.
<select>
{% for states in craft.commerce.countries %}
<option value="{{ state.id }}">{{ state.name }}</option>
{% endfor %}
</select>
Returns an array indexed by country IDs, usable for a dropdown select box.
Data returned as [72:[3:'California', 4:'Washington'],32:[7:'New South Wales']]
<select>
{% for countryId, states in craft.commerce.states.allStatesAsList %}
<optgroup label="{{ craft.commerce.countries.countriesAsList[countryId] }}">
{% for stateId, stateName in craft.commerce.states.allStatesAsList[countryId] %}
<option value="{{ stateId }}">{{ stateName }}</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>
Returns the shipping methods available to applied to the current cart. Will not include some shipping methods if none of the shipping method's rules can match the cart.
{% for handle, method in cart.availableShippingMethods %}
<label>
<input type="radio" name="shippingMethod" value="{{ handle }}"
{% if handle == cart.shippingMethodHandle %}checked{% endif %} />
<strong>{{ method.name }}</strong> {{ method.amount|currency(cart.currency) }}
</label>
{% endfor %}
Returns all payment gateway available to the customer.
{% if not craft.commerce.gateways.allFrontEndGateways|length %}
<p>No payment methods available.</p>
{% endif %}
{% if craft.commerce.gateways.allFrontEndGateways|length %}
<form method="POST" id="paymentMethod" class="form-inline">
<input type="hidden" name="action" value="commerce/cart/updateCart">
<input type="hidden" name="redirect" value="commerce/checkout/payment">
{{ getCsrfInput() }}
<label for="">Payment Method</label>
<select id="gatewayId" name="gatewayId" class="form-control" >
{% for id,name in craft.commerce.gateways.allFrontEndGateways %}
<option value="{{ id }}" {% if id == cart.paymentMethod.id %}selected{% endif %}>{{ name }}</option>
{% endfor %}
</select>
</form>
{% endif %}
Returns an array of all custom order statuses Order Status Model set up in the system.
{% set statuses = craft.commerce.orderStatuses.allOrderStatuses %}
Returns an array of all tax categories set up in the system.
{% for taxCategory in craft.commerce.taxCategories.allTaxCategories %}
{{ taxCategory.id }} - {{ taxCategory.name }}
{% endfor %}
Returns an array of all product types set up in the system.
{% for type in craft.commerce.productTypes.allProductTypes %}
{{ type.handle }} - {{ type.name }}
{% endfor %}
Returns an array of all order statuses Order Status Model set up in the system.
{% for status in craft.commerce.orderStatuses.allOrderStatuses %}
{{ status.handle }} - {{ status.name }}
{% endfor %}
Returns an array of all discounts set up in the system.
{% for discount in craft.commerce.discounts.allDiscounts %}
{{ discount.name }} - {{ discount.description }}
{% endfor %}
Returns a discount that matches the code supplied.
{% set discount = craft.commerce.discount.getDiscountByCode('HALFOFF')
%}
{% if discount %}
{{ discount.name }} - {{ discount.description }}
{% endif %}
Returns an array of all sales set up in the system.
{% for sale in craft.commerce.allSales %}
{{ sale.name }} - {{ sale.description }}
{% endfor %}