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.
good info thx.
Thank you very very much!
set ‘required’ => false , it doesn’t work.
It’s still a required field
Hello
If possible, can any one explain me how to exactly do this, please!
I know something, not much but I altered everything I needed except this.
Thank you very much!
Hi,
i think this plugin solves this problem.
http://jigoshop.com/extend/checkout-field-manager/
But WTF is wrong with their pricing policy? 49 USD? That’s ridiculous… if not a plain rip off!
PS: You just saved me 60 USD for the plugin. Where can i donate?
You can do so in functions.php in your theme
function mt_billing_fields($args) {
$billing_fields = array();
return $billing_fields;
}
add_filter( ‘jigoshop_billing_fields’, ‘mt_billing_fields’,10,1 );
function mt_shipping_fields($args) {
$shipping_fields = array();
return $shipping_fields;
}
add_filter( ‘jigoshop_shipping_fields’, ‘mt_shipping_fields’,10,1 );
Hi, thanks a lot for this. It works fine but when I add billing-state and shipping-state (my goal is to only make postcode not a required field, having states is ok) I get this warning: Warning: Illegal offset type in isset or empty in /home/mantastikn/domains/pasikuiskim.lt/public_html/wp-content/plugins/jigoshop/classes/jigoshop_countries.class.php on line 900
any idea what could be causing this?
Hi,
I can’t swear that this solution works anymore. I believe Jigoshop has evolved quite a bit since this post was authored.
Perhaps Mihail’s solution above works!
Thanks – you are awesome. The jigoshop documentation is pretty terrible.
I’ve copied the jigoshop_checkout class into my theme, renamed it, copied all functions that interact with it and renamed them, then I’ve entered my renamed shortcode into the page and amazingly, I can mess around deleting or renaming fields in my new class and it seems to be working! The Jigoshop plugin code remains untouched.
Sure, that’s a way! But now you need to copy and rename those functions each update to make sure you’re not missing any required code, so it’s not the best way to do it.
You may have something there…
Could you tell me exactly what i should copy and past in my theme?
Hi,
The article covers it, but it requires some programming knowledge to do so.
Brilliant, thank you very much for the help! Works perfectly in the latest version 1.6.2 of Jigoshop.
Hi, this worked .. kind of, the fields worked but when i went to checkout it said “Phone (billing) is a required field.) which is the field that i took out.. so somewhere jigoshop still thinks that fields there and expecting it to be entered.. does anyone know where that is and how to change it?
I know my reply comes a bit too late (8 months late)… but if you still need a solution add this line:
array( ‘name’=>’billing-phone’, ‘validate’ => ‘phone’, ‘label’ => __(‘Phone’, ‘jigoshop’), ‘placeholder’ => __(‘Phone number’, ‘jigoshop’), ‘required’ => true )
If you need more information check my full post bellow.
Looks like Nicole is right – I have the same issue. Fields are still required whether showing or not. Suggestions?
Thanks a lot. I’v been searching for a safe way to remove some fields.
With a bit of modification this works with the latest versions:
Jigoshop Version: 1.8.1 ; WordPress Version: 3.8.1
You just need to add this line to make it work:
array( ‘name’=>’billing-phone’, ‘validate’ => ‘phone’, ‘label’ => __(‘Phone’, ‘jigoshop’), ‘placeholder’ => __(‘Phone number’, ‘jigoshop’), ‘required’ => true )
For people who don’t know where the line I mentioned should be put, here is the whole code, just copy and paste it:
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’ => __(’email’, ‘jigoshop’), ‘required’ => true ),
array( ‘name’=>’billing-phone’, ‘validate’ => ‘phone’, ‘label’ => __(‘Phone’, ‘jigoshop’), ‘placeholder’ => __(‘Phone number’, ‘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’ => __(’email’, ‘jigoshop’), ‘required’ => true )
);
jigoshop_checkout::instance()->shipping_fields = $shipping_fields;
}
} add_action ( ‘wp’, ‘jigo_mod_wp’ );
Biohazard, where should we put this lines? function.php? thank you in advance
Hi, i get an error in the theme functions.php when i copy/paste your code in before the last closing php ?> tag, and try to save the file. (… Unexpected “Name” “T-string” … line 766…) . I use WP 3.9.2 and Jigoshop 1.11.1.
hello sir, Can I add a select option in this field?
The current jigoshop ‘billing address’ and ‘shipping address’ display as: Custom Name then on the next line, address, city, state, zip – all on one line. My customer would like the address to print more traditionally as it is difficult for them to read. I know, I know…. But they also claim it makes it difficult to paste into a label maker program, which may be plausible. Anyway, they want the address to print:
Customer Name
Customer address
Customer City, State, Zip.
Could you help me determine the best way to handle this?
Thanks!