Configuration

In addition to the settings available in the CP Commerce > Settings screen, the config items below can be placed into a commerce.php file in your craft/config directory:

cartCookieDuration #

A php Date Interval
Default: 3 months. (P3M).

How long the cookie storing the cart should last. The cart exists independently of the Craft users’ session.

purgeInactiveCarts #

Default: True

Should Commerce purge old inactive carts from the database. See the purgeInactiveCartsDuration setting to control how old the cart needs to be.

purgeInactiveCartsDuration #

A php Date Interval
Default: 3 months. (P3M).

Inactive carts older than this interval from their last update will be purged (deleted).

The interval check for purging of inactive carts is only run when visiting the Order Index screen in the control panel.

paymentMethodSettings #

Allows for the overriding of Payment Method settings. You still need to configure the Payment Method in the control panel so you can reference the ID as the key to the Payment Method’s settings. Example:

<?php
return [

    // he * must be present to enable multi-environment configs, even if empty
    '*' => array(
    ),

    // DEV Details - i.e. your Paypal sandbox details for example
    'dev.whatever.net' => array(

        'paymentMethodSettings' => [
            //eWay Sandbox
            '1' => [
                'testMode' => true,
                'apiKey' => 'whatever',
                'password' => 'whatever',
                'CSEKey' => 'whatever',

            ],           
            // 4 - Paypal Express
            '4' => [
                'testMode' => true,
                'password' => 'whatever',
                'username' => 'whatever',
                'signature' => 'whatever'
            ],
        ],
    ),

    // PRODUCTION Details - live payment stuff here
    'whatever.com' => array(             
        'paymentMethodSettings' => [
            //eWay LIVE
            '1' => [
                'testMode' => false,
                'apiKey' => 'whatever',
                'password' => 'whatever',
                'CSEKey' => 'whatever',
            ],
            // 4 - Paypal Express
            '4' => [
                'testMode' => false,
                'password' => 'whatever',
                'username' => 'whatever',
                'signature' => 'whatever'
            ],            
        ],        
    ),    
];

gatewayPostRedirectTemplate #

Allows for the overriding of the template used to perform POST redirects to the payment gateway.

The template path that this item points to must contain a form that submits itself to the actionUrl variable, and outputs all hidden inputs with the inputs variable. Below is an example template:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Redirecting...</title>
</head>
<body onload="document.forms[0].submit();">
<form action="{{ actionUrl|raw }}" method="post">
    <p>Redirecting to payment page...</p>
    <p>
        {{ inputs|raw }}
        <input type="submit" value="Continue" />
    </p>
</form>
</body>
</html>

Since this template is simply used for redirecting, it only appears for a few seconds, so we suggest making it loads fast with minimal images and inlined styles to reduce http requests.

sendCartInfoToGateways #

Defines whether Commerce should include information about the cart’s line items and adjustments when sending payment requests to gateways. This is not required for most gateways as they only care about the payment amount, but some will complain if they can’t see a list of line items and their qty.

Can be set to true or false (default is true).

'sendCartInfoToGateways' => false,

requireShippingAddressAtCheckout #

Determines whether payment requests made to the commerce/payments/pay controller action require a shipping address to be present on an order before attempting payment.

Can be set to true or false (default is false).

requireEmailForAnonymousPayments #

Determines whether payment requests made to the commerce/payments/pay controller action require the email address of the order to be submitted with an email POST param that matches the order the user is trying to make payment on.

Can be set to true or false (default is false).

useBillingAddressForTax #

Determines whether to use the billing address of the cart to calculate taxes. By default the shipping address is used for tax calculations.

Can be set to true or false (default is false).

requireBillingAddressAtCheckout #

Determines whether the billing address needs to exist on the cart in order to submit successfully to the commerce/payment/pay action.

Can be set to true or false (default is false).

Buy Craft Commerce

Craft Commerce site license

Includes

  • Standard tech support
  • Unlimited app updates
  • Craft Pro site license
Buy now for $999
Can I try before buying?

Absolutely. Just download it from the “Download” button in the site header and follow our installation instructions. You’ll have the full feature set to experiment with, with just one limitation: you won’t be able to charge credit cards. Until Craft Commerce has been purchased and activated, it’s limited to a single dummy gateway.

Will there be recurring/upgrade fees?

Nope, it’s just a one-time license fee per site.

Can I use this on an existing Craft site?

Yes! And if you already have a Craft Pro license (or you don’t need one), just flip that “Include a Craft Pro license” switch in the purchase form, and we’ll drop the price to $700.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Client and Personal editions as well!

Can I try before buying?

Absolutely. Just download it from the “Download” button in the site header and follow our installation instructions. You’ll have the full feature set to experiment with, with just one limitation: you won’t be able to charge credit cards. Until Craft Commerce has been purchased and activated, it’s limited to a single dummy gateway.

Will there be recurring/upgrade fees?

Nope, it’s just a one-time license fee per site.

Can I use this on an existing Craft site?

Yes! And if you already have a Craft Pro license (or you don’t need one), just flip that “Include a Craft Pro license” switch in the purchase form, and we’ll drop the price to $700.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Client and Personal editions as well!