Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Remove vendor location fields and reorder
- This topic has 21 replies, 3 voices, and was last updated 4 years, 6 months ago by Sushobhan.
- AuthorPosts
- April 26, 2020 at 12:35 pm #123192HenrietteParticipant
Hi,
I would like to remove Street 2 and Country from vendor dashboard > Location.
Also I would like to have Postcode first and than City/Town. Is this possible?Also I can not reply to another topic on this forum.
Please see attachments.
Thank you.Attachments:
You must be logged in to view attached files. - April 26, 2020 at 2:01 pm #123204SushobhanKeymaster
Hello,
Try the following snippet-add_filter( 'wcfm_marketplace_settings_fields_address', function( $fields ) { if ( ! current_user_can( 'administrator' ) ) { $shuffled_fields = array(); if ( isset( $fields['street_1'] ) ) $shuffled_fields['street_1'] = $fields['street_1']; if ( isset( $fields['zip'] ) ) $shuffled_fields['zip'] = $fields['zip']; if ( isset( $fields['city'] ) ) $shuffled_fields['city'] = $fields['city']; if ( isset( $fields['state'] ) ) $shuffled_fields['state'] = $fields['state']; if ( isset( $fields['country'] ) ) { $shuffled_fields['country'] = $fields['country']; $shuffled_fields['country']['type'] = 'hidden'; } return $shuffled_fields; } return $fields; }, 10 );
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
Let me know how this goes.
Thanks! - April 26, 2020 at 4:03 pm #123247SebastianFloKaParticipant
Hi Sushobhan,
do you also know how to move the postal code upfront the town on the store page of a vendor?
https://wclovers.com/forums/topic/move-position-of-postal-code/
Thank you.- April 27, 2020 at 4:10 pm #123652SushobhanKeymaster
Hi,
You can try using the following snippet-add_filter( 'wcfmmp_store_address_string', function( $store_address, $vendor_data ) { $address = array(); if ( ! empty( $vendor_data['address'] ) ) { if ( isset( $vendor_data['address']['street_1'] ) ) $address[] = $vendor_data['address']['street_1']; if ( isset( $vendor_data['address']['street_2'] ) ) $address[] = $vendor_data['address']['street_2']; if ( isset( $vendor_data['address']['zip'] ) ) $address[] = $vendor_data['address']['zip']; if ( isset( $vendor_data['address']['city'] ) ) $address[] = $vendor_data['address']['city']; if ( isset( $vendor_data['address']['state'] ) ) $address[] = $vendor_data['address']['state']; if ( isset( $vendor_data['address']['country'] ) ) $address[] = $vendor_data['address']['country']; } return implode( ', ', array_filter( $address ) ); }, 10, 2 );
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
Let me know how this goes.
Thanks!
- April 26, 2020 at 5:20 pm #123269HenrietteParticipant
Unfortunately that does not work. It doesn’t change anything in Vendor Dashboard.
Also I don’t need State. Only:Street 1
Postcode
City - April 26, 2020 at 5:36 pm #123272SebastianFloKaParticipant
I checked and it changes only on the page during the registration process of a vendor.
Why do you want to have the postal code etc. changed on the dahboard and not on the store page of a vendor or on the invoices etc., where it’s much more visible to many more people (customers)? As my request is… - April 26, 2020 at 6:01 pm #123274HenrietteParticipant
Why do you want to have the postal code etc. changed on the dahsboard and not on the store page of a vendor or on the invoices etc
Everything that Vendor fills in in his dashboard > Location is visible on his store page when you activate widget in the side bar.
If he doesn’t fill a field than that field is not visible on his storefront except for Country. But vendor doesn’t know that so the street 2 field is confusing.
Also I don’t need Country visible at storefront because I will be having only vendors from my own country.Plus the order of address in my country is:
Street
Postcode
CityOther info you can create with Store Invoice.
- April 27, 2020 at 4:06 pm #123650SushobhanKeymaster
@Henriette, the purpose of the last snippet was-
1. remove Street 2 and Country from vendor dashboard > Location.
2. bring Postcode first and than City/Town
And it does just that. But as you mentioned in your last message that you want to hide state field as well from Vendor settings >> location and make it consistent with the store page; so here is the updated snippet (kindly remove the older one)-
add_filter( 'wcfm_marketplace_settings_fields_address', function( $fields ) { if ( ! current_user_can( 'administrator' ) ) { $shuffled_fields = array(); if ( isset( $fields['street_1'] ) ) $shuffled_fields['street_1'] = $fields['street_1']; if ( isset( $fields['zip'] ) ) $shuffled_fields['zip'] = $fields['zip']; if ( isset( $fields['city'] ) ) $shuffled_fields['city'] = $fields['city']; if ( isset( $fields['state'] ) ) { $shuffled_fields['state'] = $fields['state']; $shuffled_fields['state']['type'] = 'hidden'; } if ( isset( $fields['country'] ) ) { $shuffled_fields['country'] = $fields['country']; $shuffled_fields['country']['type'] = 'hidden'; } return $shuffled_fields; } return $fields; }, 10 ); add_filter( 'wcfmmp_store_address_string', function( $store_address, $vendor_data ) { $address = array(); if ( ! empty( $vendor_data['address'] ) ) { if ( isset( $vendor_data['address']['street_1'] ) ) $address[] = $vendor_data['address']['street_1']; if ( isset( $vendor_data['address']['zip'] ) ) $address[] = $vendor_data['address']['zip']; if ( isset( $vendor_data['address']['city'] ) ) $address[] = $vendor_data['address']['city']; } return implode( ', ', array_filter( $address ) ); }, 10, 2 );
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/ (more preferred option)
Let me know how this goes.
Thanks! - April 27, 2020 at 5:26 pm #123688SebastianFloKaParticipant
Hi,
thank you, that’s almost exactly what I was looking for. Now it works also on the store page. Thanks.
Only question: I tried to eliminate the “,” comma between ZIP and Town, because then it would be perfect. But I tried so much but doesn’t work – time for me to learn programming.
If it’s simple, could you give a hint, please? If difficult, leafe it.
Thanks again.- April 27, 2020 at 7:07 pm #123728SushobhanKeymaster
Hi SebastianFloka,
No need to worry, I just made the modifications for you. Kindly use the following snippet instead-add_filter( 'wcfmmp_store_address_string', function( $store_address, $vendor_data ) { $address = array(); if ( ! empty( $vendor_data['address'] ) ) { if ( isset( $vendor_data['address']['street_1'] ) ) $address[] = $vendor_data['address']['street_1']; if ( isset( $vendor_data['address']['street_2'] ) ) $address[] = $vendor_data['address']['street_2']; $postcode_city = ''; if ( isset( $vendor_data['address']['zip'] ) ) $postcode_city = $vendor_data['address']['zip']; if ( isset( $vendor_data['address']['city'] ) ) $postcode_city .= " " . $vendor_data['address']['city']; if($postcode_city) $address[] = trim( $postcode_city ); if ( isset( $vendor_data['address']['state'] ) ) $address[] = $vendor_data['address']['state']; if ( isset( $vendor_data['address']['country'] ) ) $address[] = $vendor_data['address']['country']; } return implode( ', ', array_filter( $address ) ); }, 10, 2 );
I can see the full smile now! π
- April 27, 2020 at 7:14 pm #123732SebastianFloKaParticipant
yes, full smile now!!
Thanks a lot.- April 27, 2020 at 7:45 pm #123751SushobhanKeymaster
You are always welcome π
Let me know if there’s anything else we can help you with.
Can we ask for a favor? Would you mind taking a few minutes to review our plugin (if you havenβt already) at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.- April 27, 2020 at 8:19 pm #123768SebastianFloKaParticipant
… well, I will give a good rating once I’m able to go live which I’m trying to do since almost half a year now. Main issues:
https://wclovers.com/forums/topic/wcfm-germanized-entering-a-delivery-time-crashes-product-manager/
https://wclovers.com/forums/topic/customers-receive-one-email-for-each-product-shipped/
and particularly https://wclovers.com/forums/topic/wcfm-germanized-split-tax-on-off-causing-issues-with-vat-on-shipping-cost/
By the way, the last one is not a germanized issue anymore, it affects all WCFM users with business and non business vendors at the same time.
- April 27, 2020 at 5:43 pm #123699
- April 27, 2020 at 6:00 pm #123704
- April 27, 2020 at 7:07 pm #123727SebastianFloKaParticipant
thank you, but comma is great everywhere except between zip and town, if you know what I mean. Your modification changes everything, not only between zip and town.
- April 27, 2020 at 7:12 pm #123730HenrietteParticipant
Yes I know what you mean.
Normally when you write in on one line in my country it is:
Street, Postcode Cityor:
Street
Postcode CityBut having it on separate lines I don’t mind so much that postcode is also on a separate line π
Street
Postcode
City - April 27, 2020 at 7:22 pm #123737HenrietteParticipant
Hi SebastianFloka,
No need to worry, I just made the modifications for you. Kindly use the following snippet instead-Oh my gosh Sushobhan you’re the best!
I was already happy with the snippet you gave me and personally I would not have dare to ask for the function that Sebastian did hahaha.
But now I’m completely happy π
Thanks to you too Sebastian π - April 27, 2020 at 8:07 pm #123764HenrietteParticipant
One more question please Sushobhan…
I use Vendor address in store side bar for vendors who have a Local Pickup option.
I would like to give them the option to not show the address when they don’t want Local Pickup.
Vendor can choose not to enter the address fields in his dashboard so nothing shows op in the sidebar.
But than still the Address header is visible.When I remove this with CSS all the other headers in the sidebar disappear too.
Is it possible to hide the Address header when vendor doesn’t fill in anything in the Location fields in his dashboard and that it only pops up when vendor does fill in his location?Hiding only the total address header will be fine too.
Customers can see that this is the store address without the header anyway.Attachments:
You must be logged in to view attached files. - April 27, 2020 at 8:40 pm #123777SushobhanKeymaster
I use Vendor address in store side bar for vendors who have a Local Pickup option.
Please tell me, how are you doing this? Is this a widget? Or via some custom code?
Thank You! - April 28, 2020 at 10:00 am #124030HenrietteParticipant
Please tell me, how are you doing this? Is this a widget? Or via some custom code?
Yes I do. In a widget with wcfm short code.
But never mind.
I thought the widget title was required but it turns out you just can leave it blank and save.
Than the header is not showing.Thank you
Attachments:
You must be logged in to view attached files. - April 28, 2020 at 6:13 pm #124258SushobhanKeymaster
Great.. Thanks for the update! π
- AuthorPosts
- You must be logged in to reply to this topic.