Home / Admin / How to change the store address country for all vendors
Duplicate Snippet

Embed Snippet on Your Site

How to change the store address country for all vendors

Code Preview
php
<?php
/**
 * Set the vendor's store country to us.
 */
function wcv_set_vendor_country() {
	if ( function_exists( 'set_time_limit' ) ) {
		set_time_limit( 0 );
	}
	$vendor_ids = get_users(
		array(
			'role__in' => array(
				'vendor',
				'pending_vendor',
			),
			'number'   => -1,
			'fields'   => 'ids',
		)
	);
	if ( count( $vendor_ids ) === 0 ) {
		return;
	}
	foreach ( $vendor_ids as $vendor_id ) {
		update_user_meta( $vendor_id, '_wcv_store_country', 'US' );
	}
}

Comments

Add a Comment