I recently discovered Jigoshop. A very nice, lightweight and well coded e-Commerce plugin for WordPress.
After some experimenting I found that the checkout and it’s fields for billing and shipping information where defined in the code and could not be modified in the settings.
It was a problem since they had set State as a required field, which most countries outside of US don’t have. In their forums there were many threads regarding this subject, and the answer the support staff gave was to modify the plugin files (!!) which you never should do.
So here’s an update safe to do it.
Create a plugin or add this to your theme’s functions.php
function jigo_mod_wp() {
if ( class_exists( 'jigoshop_checkout' ) ) {
$billing_fields = array(
array( 'name'=>'billing-first_name', 'label' => __('First Name', 'jigoshop'), 'placeholder' => __('First Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'billing-last_name', 'label' => __('Last Name', 'jigoshop'), 'placeholder' => __('Last Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'billing-address', 'label' => __('Address', 'jigoshop'), 'placeholder' => __('Address', 'jigoshop'), 'required' => true ),
array( 'name'=>'billing-city', 'label' => __('City', 'jigoshop'), 'placeholder' => __('City', 'jigoshop'), 'required' => true ),
array( 'validate' => 'postcode', 'format' => 'postcode', 'name'=>'billing-postcode', 'label' => __('Postcode', 'jigoshop'), 'placeholder' => __('Postcode', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'type'=> 'country', 'name'=>'billing-country', 'label' => __('Country', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'billing-email', 'validate' => 'email', 'label' => __('Email Address', 'jigoshop'), 'placeholder' => __('***@yourdomain.com', 'jigoshop'), 'required' => true )
);
jigoshop_checkout::instance()->billing_fields = $billing_fields;
$shipping_fields = array(
array( 'name'=>'shipping-first_name', 'label' => __('First Name', 'jigoshop'), 'placeholder' => __('First Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'shipping-last_name', 'label' => __('Last Name', 'jigoshop'), 'placeholder' => __('Last Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'shipping-address', 'label' => __('Address', 'jigoshop'), 'placeholder' => __('Address', 'jigoshop'), 'required' => true ),
array( 'name'=>'shipping-city', 'label' => __('City', 'jigoshop'), 'placeholder' => __('City', 'jigoshop'), 'required' => true ),
array( 'validate' => 'postcode', 'format' => 'postcode', 'name'=>'billing-postcode', 'label' => __('Postcode', 'jigoshop'), 'placeholder' => __('Postcode', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'type'=> 'country', 'name'=>'shipping-country', 'label' => __('Country', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'shipping-email', 'validate' => 'email', 'label' => __('Email Address', 'jigoshop'), 'placeholder' => __('***@yourdomain.com', 'jigoshop'), 'required' => true )
);
jigoshop_checkout::instance()->shipping_fields = $shipping_fields;
}
} add_action ( 'wp', 'jigo_mod_wp' );
Modify the array and add/remove the fields you want. Some of the items have an array item called required which controls whether a field is required or not.
Always fun to see great plugins that also are pluggable which is a MUST for it to be useful for developers.