Completed
Pull Request — master (#9826)
by Mike
22:02
created

WC_Admin_Setup_Wizard   C

Complexity

Total Complexity 79

Size/Duplication

Total Lines 746
Duplicated Lines 2.68 %

Coupling/Cohesion

Components 2
Dependencies 10
Metric Value
wmc 79
lcom 2
cbo 10
dl 20
loc 746
rs 5

19 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 3
A admin_menus() 0 3 1
C setup_wizard() 0 78 8
A get_next_step_link() 0 4 1
A setup_wizard_header() 0 16 1
A setup_wizard_footer() 0 9 2
A setup_wizard_steps() 0 17 4
A setup_wizard_content() 0 5 1
A wc_setup_introduction() 0 11 1
B wc_setup_pages() 0 46 1
A wc_setup_pages_save() 0 7 1
B wc_setup_locale() 0 94 6
A wc_setup_locale_save() 0 22 1
D wc_setup_shipping_taxes() 10 115 9
F wc_setup_shipping_taxes_save() 10 97 19
B wc_setup_payments() 0 55 5
B wc_setup_payments_save() 0 25 6
B wc_setup_ready_actions() 0 11 7
B wc_setup_ready() 0 38 2

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like WC_Admin_Setup_Wizard often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use WC_Admin_Setup_Wizard, and based on these observations, apply Extract Interface, too.

1
<?php
1 ignored issue
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 19 and the first side effect is on line 13.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Setup Wizard Class
4
 *
5
 * Takes new users through some basic steps to setup their store.
6
 *
7
 * @author      WooThemes
8
 * @category    Admin
9
 * @package     WooCommerce/Admin
10
 * @version     2.4.0
11
*/
12
if ( ! defined( 'ABSPATH' ) ) {
13
	exit;
14
}
15
16
/**
17
 * WC_Admin_Setup_Wizard class.
18
 */
19
class WC_Admin_Setup_Wizard {
20
21
	/** @var string Currenct Step */
22
	private $step   = '';
23
24
	/** @var array Steps for the setup wizard */
25
	private $steps  = array();
26
27
	/** @var array Tweets user can optionally send after install */
28
	private $tweets = array(
29
		'Someone give me woo-t, I just set up a new store with #WordPress and @WooCommerce!',
30
		'Someone give me high five, I just set up a new store with #WordPress and @WooCommerce!'
31
	);
32
33
	/**
34
	 * Hook in tabs.
35
	 */
36
	public function __construct() {
37
		if ( apply_filters( 'woocommerce_enable_setup_wizard', true ) && current_user_can( 'manage_woocommerce' ) ) {
38
			add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
			add_action( 'admin_init', array( $this, 'setup_wizard' ) );
40
		}
41
	}
42
43
	/**
44
	 * Add admin menus/screens.
45
	 */
46
	public function admin_menus() {
47
		add_dashboard_page( '', '', 'manage_options', 'wc-setup', '' );
48
	}
49
50
	/**
51
	 * Show the setup wizard.
52
	 */
53
	public function setup_wizard() {
54
		if ( empty( $_GET['page'] ) || 'wc-setup' !== $_GET['page'] ) {
55
			return;
56
		}
57
		$this->steps = array(
58
			'introduction' => array(
59
				'name'    =>  __( 'Introduction', 'woocommerce' ),
60
				'view'    => array( $this, 'wc_setup_introduction' ),
61
				'handler' => ''
62
			),
63
			'pages' => array(
64
				'name'    =>  __( 'Page Setup', 'woocommerce' ),
65
				'view'    => array( $this, 'wc_setup_pages' ),
66
				'handler' => array( $this, 'wc_setup_pages_save' )
67
			),
68
			'locale' => array(
69
				'name'    =>  __( 'Store Locale', 'woocommerce' ),
70
				'view'    => array( $this, 'wc_setup_locale' ),
71
				'handler' => array( $this, 'wc_setup_locale_save' )
72
			),
73
			'shipping_taxes' => array(
74
				'name'    =>  __( 'Shipping &amp; Tax', 'woocommerce' ),
75
				'view'    => array( $this, 'wc_setup_shipping_taxes' ),
76
				'handler' => array( $this, 'wc_setup_shipping_taxes_save' ),
77
			),
78
			'payments' => array(
79
				'name'    =>  __( 'Payments', 'woocommerce' ),
80
				'view'    => array( $this, 'wc_setup_payments' ),
81
				'handler' => array( $this, 'wc_setup_payments_save' ),
82
			),
83
			'next_steps' => array(
84
				'name'    =>  __( 'Ready!', 'woocommerce' ),
85
				'view'    => array( $this, 'wc_setup_ready' ),
86
				'handler' => ''
87
			)
88
		);
89
		$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
90
		$suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
91
92
		wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
93
		wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.2' );
94
		wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), WC_VERSION );
95
		wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array(
96
			'i18n_matches_1'            => _x( 'One result is available, press enter to select it.', 'enhanced select', 'woocommerce' ),
97
			'i18n_matches_n'            => _x( '%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce' ),
98
			'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'woocommerce' ),
99
			'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'woocommerce' ),
100
			'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'woocommerce' ),
101
			'i18n_input_too_short_n'    => _x( 'Please enter %qty% or more characters', 'enhanced select', 'woocommerce' ),
102
			'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'woocommerce' ),
103
			'i18n_input_too_long_n'     => _x( 'Please delete %qty% characters', 'enhanced select', 'woocommerce' ),
104
			'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'woocommerce' ),
105
			'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'woocommerce' ),
106
			'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'woocommerce' ),
107
			'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'woocommerce' ),
108
			'ajax_url'                  => admin_url( 'admin-ajax.php' ),
109
			'search_products_nonce'     => wp_create_nonce( 'search-products' ),
110
			'search_customers_nonce'    => wp_create_nonce( 'search-customers' )
111
		) );
112
		wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
113
		wp_enqueue_style( 'wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array( 'dashicons', 'install' ), WC_VERSION );
114
115
		wp_register_script( 'wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup.min.js', array( 'jquery', 'wc-enhanced-select', 'jquery-blockui' ), WC_VERSION );
116
		wp_localize_script( 'wc-setup', 'wc_setup_params', array(
117
			'locale_info' => json_encode( include( WC()->plugin_path() . '/i18n/locale-info.php' ) )
118
		) );
119
120
		if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
121
			call_user_func( $this->steps[ $this->step ]['handler'] );
122
		}
123
124
		ob_start();
125
		$this->setup_wizard_header();
126
		$this->setup_wizard_steps();
127
		$this->setup_wizard_content();
128
		$this->setup_wizard_footer();
129
		exit;
130
	}
131
132
	public function get_next_step_link() {
133
		$keys = array_keys( $this->steps );
134
		return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] );
135
	}
136
137
	/**
138
	 * Setup Wizard Header.
139
	 */
140
	public function setup_wizard_header() {
141
		?>
142
		<!DOCTYPE html>
143
		<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
144
		<head>
145
			<meta name="viewport" content="width=device-width" />
146
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
147
			<title><?php _e( 'WooCommerce &rsaquo; Setup Wizard', 'woocommerce' ); ?></title>
148
			<?php wp_print_scripts( 'wc-setup' ); ?>
149
			<?php do_action( 'admin_print_styles' ); ?>
150
			<?php do_action( 'admin_head' ); ?>
151
		</head>
152
		<body class="wc-setup wp-core-ui">
153
			<h1 id="wc-logo"><a href="http://woothemes.com/woocommerce"><img src="<?php echo WC()->plugin_url(); ?>/assets/images/woocommerce_logo.png" alt="WooCommerce" /></a></h1>
154
		<?php
155
	}
156
157
	/**
158
	 * Setup Wizard Footer.
159
	 */
160
	public function setup_wizard_footer() {
161
		?>
162
			<?php if ( 'next_steps' === $this->step ) : ?>
163
				<a class="wc-return-to-dashboard" href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Return to the WordPress Dashboard', 'woocommerce' ); ?></a>
164
			<?php endif; ?>
165
			</body>
166
		</html>
167
		<?php
168
	}
169
170
	/**
171
	 * Output the steps.
172
	 */
173
	public function setup_wizard_steps() {
174
		$ouput_steps = $this->steps;
175
		array_shift( $ouput_steps );
176
		?>
177
		<ol class="wc-setup-steps">
178
			<?php foreach ( $ouput_steps as $step_key => $step ) : ?>
179
				<li class="<?php
180
					if ( $step_key === $this->step ) {
181
						echo 'active';
182
					} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
183
						echo 'done';
184
					}
185
				?>"><?php echo esc_html( $step['name'] ); ?></li>
186
			<?php endforeach; ?>
187
		</ol>
188
		<?php
189
	}
190
191
	/**
192
	 * Output the content for the current step.
193
	 */
194
	public function setup_wizard_content() {
195
		echo '<div class="wc-setup-content">';
196
		call_user_func( $this->steps[ $this->step ]['view'] );
197
		echo '</div>';
198
	}
199
200
	/**
201
	 * Introduction step.
202
	 */
203
	public function wc_setup_introduction() {
204
		?>
205
		<h1><?php _e( 'Welcome to the world of WooCommerce!', 'woocommerce' ); ?></h1>
206
		<p><?php _e( 'Thank you for choosing WooCommerce to power your online store! This quick setup wizard will help you configure the basic settings. <strong>It’s completely optional and shouldn’t take longer than five minutes.</strong>', 'woocommerce' ); ?></p>
207
		<p><?php _e( 'No time right now? If you don’t want to go through the wizard, you can skip and return to the WordPress dashboard. Come back anytime if you change your mind!', 'woocommerce' ); ?></p>
208
		<p class="wc-setup-actions step">
209
			<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button-primary button button-large button-next"><?php _e( 'Let\'s Go!', 'woocommerce' ); ?></a>
210
			<a href="<?php echo esc_url( admin_url() ); ?>" class="button button-large"><?php _e( 'Not right now', 'woocommerce' ); ?></a>
211
		</p>
212
		<?php
213
	}
214
215
	/**
216
	 * Page setup.
217
	 */
218
	public function wc_setup_pages() {
219
		?>
220
		<h1><?php _e( 'Page Setup', 'woocommerce' ); ?></h1>
221
		<form method="post">
222
			<p><?php printf( __( 'Your store needs a few essential %spages%s. The following will be created automatically (if they do not already exist):', 'woocommerce' ), '<a href="' . esc_url( admin_url( 'edit.php?post_type=page' ) ) . '" target="_blank">', '</a>' ); ?></p>
223
			<table class="wc-setup-pages" cellspacing="0">
224
				<thead>
225
					<tr>
226
						<th class="page-name"><?php _e( 'Page Name', 'woocommerce' ); ?></th>
227
						<th class="page-description"><?php _e( 'Description', 'woocommerce' ); ?></th>
228
					</tr>
229
				</thead>
230
				<tbody>
231
					<tr>
232
						<td class="page-name"><?php echo _x( 'Shop', 'Page title', 'woocommerce' ); ?></td>
233
						<td><?php _e( 'The shop page will display your products.', 'woocommerce' ); ?></td>
234
					</tr>
235
					<tr>
236
						<td class="page-name"><?php echo _x( 'Cart', 'Page title', 'woocommerce' ); ?></td>
237
						<td><?php _e( 'The cart page will be where the customers go to view their cart and begin checkout.', 'woocommerce' ); ?></td>
238
					</tr>
239
					<tr>
240
						<td class="page-name"><?php echo _x( 'Checkout', 'Page title', 'woocommerce' ); ?></td>
241
						<td>
242
							<?php _e( 'The checkout page will be where the customers go to pay for their items.', 'woocommerce' ); ?>
243
						</td>
244
					</tr>
245
					<tr>
246
						<td class="page-name"><?php echo _x( 'My Account', 'Page title', 'woocommerce' ); ?></td>
247
						<td>
248
							<?php _e( 'Registered customers will be able to manage their account details and view past orders on this page.', 'woocommerce' ); ?>
249
						</td>
250
					</tr>
251
				</tbody>
252
			</table>
253
254
			<p><?php printf( __( 'Once created, these pages can be managed from your admin dashboard on the %sPages screen%s. You can control which pages are shown on your website via %sAppearance > Menus%s.', 'woocommerce' ), '<a href="' . esc_url( admin_url( 'edit.php?post_type=page' ) ) . '" target="_blank">', '</a>', '<a href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '" target="_blank">', '</a>' ); ?></p>
255
256
			<p class="wc-setup-actions step">
257
				<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" />
258
				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large button-next"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
259
				<?php wp_nonce_field( 'wc-setup' ); ?>
260
			</p>
261
		</form>
262
		<?php
263
	}
264
265
	/**
266
	 * Save Page Settings.
267
	 */
268
	public function wc_setup_pages_save() {
269
		check_admin_referer( 'wc-setup' );
270
271
		WC_Install::create_pages();
272
		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
273
		exit;
274
	}
275
276
	/**
277
	 * Locale settings.
278
	 */
279
	public function wc_setup_locale() {
280
		$user_location  = WC_Geolocation::geolocate_ip();
281
		$country        = ! empty( $user_location['country'] ) ? $user_location['country'] : 'US';
282
		$state          = ! empty( $user_location['state'] ) ? $user_location['state'] : '*';
283
		$state          = 'US' === $country && '*' === $state ? 'AL' : $state;
284
285
		// Defaults
286
		$currency       = get_option( 'woocommerce_currency', 'GBP' );
287
		$currency_pos   = get_option( 'woocommerce_currency_pos', 'left' );
288
		$decimal_sep    = get_option( 'woocommerce_price_decimal_sep', '.' );
289
		$thousand_sep   = get_option( 'woocommerce_price_thousand_sep', ',' );
290
		$dimension_unit = get_option( 'woocommerce_dimension_unit', 'cm' );
291
		$weight_unit    = get_option( 'woocommerce_weight_unit', 'kg' );
292
		?>
293
		<h1><?php _e( 'Store Locale Setup', 'woocommerce' ); ?></h1>
294
		<form method="post">
295
			<table class="form-table">
296
				<tr>
297
					<th scope="row"><label for="store_location"><?php _e( 'Where is your store based?', 'woocommerce' ); ?></label></th>
298
					<td>
299
					<select id="store_location" name="store_location" style="width:100%;" required data-placeholder="<?php esc_attr_e( 'Choose a country&hellip;', 'woocommerce' ); ?>" class="wc-enhanced-select">
300
							<?php WC()->countries->country_dropdown_options( $country, $state ); ?>
301
						</select>
302
					</td>
303
				</tr>
304
				<tr>
305
					<th scope="row"><label for="currency_code"><?php _e( 'Which currency will your store use?', 'woocommerce' ); ?></label></th>
306
					<td>
307
						<select id="currency_code" name="currency_code" style="width:100%;" data-placeholder="<?php esc_attr_e( 'Choose a currency&hellip;', 'woocommerce' ); ?>" class="wc-enhanced-select">
308
							<option value=""><?php _e( 'Choose a currency&hellip;', 'woocommerce' ); ?></option>
309
							<?php
310
							foreach ( get_woocommerce_currencies() as $code => $name ) {
311
								echo '<option value="' . esc_attr( $code ) . '" ' . selected( $currency, $code, false ) . '>' . esc_html( $name . ' (' . get_woocommerce_currency_symbol( $code ) . ')' ) . '</option>';
312
							}
313
							?>
314
						</select>
315
						<span class="description"><?php printf( __( 'If your currency is not listed you can %sadd it later%s.', 'woocommerce' ), '<a href="http://docs.woothemes.com/document/add-a-custom-currency-symbol/" target="_blank">', '</a>' ); ?></span>
316
					</td>
317
				</tr>
318
				<tr>
319
					<th scope="row"><label for="currency_pos"><?php _e( 'Currency Position', 'woocommerce' ); ?></label></th>
320
					<td>
321
						<select id="currency_pos" name="currency_pos" class="wc-enhanced-select">
322
							<option value="left" <?php selected( $currency_pos, 'left' ); ?>><?php echo __( 'Left', 'woocommerce' ); ?></option>
323
							<option value="right" <?php selected( $currency_pos, 'right' ); ?>><?php echo __( 'Right', 'woocommerce' ); ?></option>
324
							<option value="left_space" <?php selected( $currency_pos, 'left_space' ); ?>><?php echo __( 'Left with space', 'woocommerce' ); ?></option>
325
							<option value="right_space" <?php selected( $currency_pos, 'right_space' ); ?>><?php echo __( 'Right with space', 'woocommerce' ); ?></option>
326
						</select>
327
					</td>
328
				</tr>
329
				<tr>
330
					<th scope="row"><label for="thousand_sep"><?php _e( 'Thousand Separator', 'woocommerce' ); ?></label></th>
331
					<td>
332
						<input type="text" id="thousand_sep" name="thousand_sep" size="2" value="<?php echo esc_attr( $thousand_sep ) ; ?>" />
333
					</td>
334
				</tr>
335
				<tr>
336
					<th scope="row"><label for="decimal_sep"><?php _e( 'Decimal Separator', 'woocommerce' ); ?></label></th>
337
					<td>
338
						<input type="text" id="decimal_sep" name="decimal_sep" size="2" value="<?php echo esc_attr( $decimal_sep ) ; ?>" />
339
					</td>
340
				</tr>
341
				<tr>
342
					<th scope="row"><label for="weight_unit"><?php _e( 'Which unit should be used for product weights?', 'woocommerce' ); ?></label></th>
343
					<td>
344
						<select id="weight_unit" name="weight_unit" class="wc-enhanced-select">
345
							<option value="kg" <?php selected( $weight_unit, 'kg' ); ?>><?php echo __( 'kg', 'woocommerce' ); ?></option>
346
							<option value="g" <?php selected( $weight_unit, 'g' ); ?>><?php echo __( 'g', 'woocommerce' ); ?></option>
347
							<option value="lbs" <?php selected( $weight_unit, 'lbs' ); ?>><?php echo __( 'lbs', 'woocommerce' ); ?></option>
348
							<option value="oz" <?php selected( $weight_unit, 'oz' ); ?>><?php echo __( 'oz', 'woocommerce' ); ?></option>
349
						</select>
350
					</td>
351
				</tr>
352
				<tr>
353
					<th scope="row"><label for="dimension_unit"><?php _e( 'Which unit should be used for product dimensions?', 'woocommerce' ); ?></label></th>
354
					<td>
355
						<select id="dimension_unit" name="dimension_unit" class="wc-enhanced-select">
356
							<option value="m" <?php selected( $dimension_unit, 'm' ); ?>><?php echo __( 'm', 'woocommerce' ); ?></option>
357
							<option value="cm" <?php selected( $dimension_unit, 'cm' ); ?>><?php echo __( 'cm', 'woocommerce' ); ?></option>
358
							<option value="mm" <?php selected( $dimension_unit, 'mm' ); ?>><?php echo __( 'mm', 'woocommerce' ); ?></option>
359
							<option value="in" <?php selected( $dimension_unit, 'in' ); ?>><?php echo __( 'in', 'woocommerce' ); ?></option>
360
							<option value="yd" <?php selected( $dimension_unit, 'yd' ); ?>><?php echo __( 'yd', 'woocommerce' ); ?></option>
361
						</select>
362
					</td>
363
				</tr>
364
			</table>
365
			<p class="wc-setup-actions step">
366
				<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" />
367
				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large button-next"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
368
				<?php wp_nonce_field( 'wc-setup' ); ?>
369
			</p>
370
		</form>
371
		<?php
372
	}
373
374
	/**
375
	 * Save Locale Settings.
376
	 */
377
	public function wc_setup_locale_save() {
378
		check_admin_referer( 'wc-setup' );
379
380
		$store_location = sanitize_text_field( $_POST['store_location'] );
381
		$currency_code  = sanitize_text_field( $_POST['currency_code'] );
382
		$currency_pos   = sanitize_text_field( $_POST['currency_pos'] );
383
		$decimal_sep    = sanitize_text_field( $_POST['decimal_sep'] );
384
		$thousand_sep   = sanitize_text_field( $_POST['thousand_sep'] );
385
		$weight_unit    = sanitize_text_field( $_POST['weight_unit'] );
386
		$dimension_unit = sanitize_text_field( $_POST['dimension_unit'] );
387
388
		update_option( 'woocommerce_default_country', $store_location );
389
		update_option( 'woocommerce_currency', $currency_code );
390
		update_option( 'woocommerce_currency_pos', $currency_pos );
391
		update_option( 'woocommerce_price_decimal_sep', $decimal_sep );
392
		update_option( 'woocommerce_price_thousand_sep', $thousand_sep );
393
		update_option( 'woocommerce_weight_unit', $weight_unit );
394
		update_option( 'woocommerce_dimension_unit', $dimension_unit );
395
396
		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
397
		exit;
398
	}
399
400
	/**
401
	 * Shipping and taxes.
402
	 */
403
	public function wc_setup_shipping_taxes() {
404
		?>
405
		<h1><?php _e( 'Shipping &amp; Tax Setup', 'woocommerce' ); ?></h1>
406
		<form method="post">
407
			<p><?php printf( __( 'If you will be charging sales tax, or shipping physical goods to customers, you can configure the basic options below. This is optional and can be changed later via %1$sWooCommerce > Settings > Tax%3$s and %2$sWooCommerce > Settings > Shipping%3$s.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=tax' ) . '" target="_blank">', '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping' ) . '" target="_blank">', '</a>' ); ?></p>
408
			<table class="form-table">
409
				<tr class="section_title">
410
					<td colspan="2">
411
						<h2><?php _e( 'Basic Shipping Setup', 'woocommerce' ); ?></h2>
412
					</td>
413
				</tr>
414
				<tr>
415
					<th scope="row"><label for="woocommerce_calc_shipping"><?php _e( 'Will you be shipping products?', 'woocommerce' ); ?></label></th>
416
					<td>
417
						<input type="checkbox" id="woocommerce_calc_shipping" <?php checked( get_option( 'woocommerce_ship_to_countries', '' ) !== 'disabled', true ); ?> name="woocommerce_calc_shipping" class="input-checkbox" value="1" />
418
						<label for="woocommerce_calc_shipping"><?php _e( 'Yes, I will be shipping physical goods to customers', 'woocommerce' ); ?></label>
419
					</td>
420
				</tr>
421
				<tr>
422
					<th scope="row"><label for="shipping_cost_domestic"><?php _e( '<strong>Domestic</strong> shipping cost:', 'woocommerce' ); ?></label></th>
423
					<td>
424
						<?php printf( __( 'A total of %s per order and/or %s per item', 'woocommerce' ), get_woocommerce_currency_symbol() . ' <input type="text" id="shipping_cost_domestic" name="shipping_cost_domestic" size="5" />', get_woocommerce_currency_symbol() . ' <input type="text" id="shipping_cost_domestic_item" name="shipping_cost_domestic_item" size="5" />' ); ?>
425
					</td>
426
				</tr>
427
				<tr>
428
					<th scope="row"><label for="shipping_cost_worldwide"><?php _e( '<strong>Worldwide</strong> shipping cost:', 'woocommerce' ); ?></label></th>
429
					<td>
430
						<?php printf( __( 'A total of %s per order and/or %s per item', 'woocommerce' ), get_woocommerce_currency_symbol() . ' <input type="text" id="shipping_cost_worldwide" name="shipping_cost_worldwide" size="5" />', get_woocommerce_currency_symbol() . ' <input type="text" id="shipping_cost_worldwide_item" name="shipping_cost_worldwide_item" size="5" />' ); ?>
431
					</td>
432
				</tr>
433
				<tr class="section_title">
434
					<td colspan="2">
435
						<h2><?php _e( 'Basic Tax Setup', 'woocommerce' ); ?></h2>
436
					</td>
437
				</tr>
438
				<tr>
439
					<th scope="row"><label for="woocommerce_calc_taxes"><?php _e( 'Will you be charging sales tax?', 'woocommerce' ); ?></label></th>
440
					<td>
441
						<input type="checkbox" <?php checked( get_option( 'woocommerce_calc_taxes', 'no' ), 'yes' ); ?> id="woocommerce_calc_taxes" name="woocommerce_calc_taxes" class="input-checkbox" value="1" />
442
						<label for="woocommerce_calc_taxes"><?php _e( 'Yes, I will be charging sales tax', 'woocommerce' ); ?></label>
443
					</td>
444
				</tr>
445
				<tr>
446
					<th scope="row"><label for="woocommerce_prices_include_tax"><?php _e( 'How will you enter product prices?', 'woocommerce' ); ?></label></th>
447
					<td>
448
						<label><input type="radio" <?php checked( get_option( 'woocommerce_prices_include_tax', 'no' ), 'yes' ); ?> id="woocommerce_prices_include_tax" name="woocommerce_prices_include_tax" class="input-radio" value="yes" /> <?php _e( 'I will enter prices inclusive of tax', 'woocommerce' ); ?></label><br/>
449
						<label><input type="radio" <?php checked( get_option( 'woocommerce_prices_include_tax', 'no' ), 'no' ); ?> id="woocommerce_prices_include_tax" name="woocommerce_prices_include_tax" class="input-radio" value="no" /> <?php _e( 'I will enter prices exclusive of tax', 'woocommerce' ); ?></label>
450
					</td>
451
				</tr>
452
				<?php
453
					$locale_info = include( WC()->plugin_path() . '/i18n/locale-info.php' );
454
					$tax_rates   = array();
455
					$country     = WC()->countries->get_base_country();
456
					$state       = WC()->countries->get_base_state();
457
458 View Code Duplication
					if ( isset( $locale_info[ $country ] ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
459
						if ( isset( $locale_info[ $country ]['tax_rates'][ $state ] ) ) {
460
							$tax_rates = $locale_info[ $country ]['tax_rates'][ $state ];
461
						} elseif ( isset( $locale_info[ $country ]['tax_rates'][''] ) ) {
462
							$tax_rates = $locale_info[ $country ]['tax_rates'][''];
463
						}
464
						if ( isset( $locale_info[ $country ]['tax_rates']['*'] ) ) {
465
							$tax_rates = array_merge( $locale_info[ $country ]['tax_rates']['*'], $tax_rates );
466
						}
467
					}
468
					if ( $tax_rates ) {
469
						?>
470
						<tr>
471
							<th scope="row"><label for="woocommerce_import_tax_rates"><?php _e( 'Import Tax Rates?', 'woocommerce' ); ?></label></th>
472
							<td>
473
								<label><input type="checkbox" id="woocommerce_import_tax_rates" name="woocommerce_import_tax_rates" class="input-checkbox" value="yes" /> <?php _e( 'Yes, please import some starter tax rates', 'woocommerce' ); ?></label>
474
								<div class="importing-tax-rates">
475
									<table class="tax-rates">
476
										<thead>
477
											<tr>
478
												<th><?php _e( 'Country', 'woocommerce' ); ?></th>
479
												<th><?php _e( 'State', 'woocommerce' ); ?></th>
480
												<th><?php _e( 'Rate (%)', 'woocommerce' ); ?></th>
481
												<th><?php _e( 'Name', 'woocommerce' ); ?></th>
482
												<th><?php _e( 'Tax Shipping', 'woocommerce' ); ?></th>
483
											</tr>
484
										</thead>
485
										<tbody>
486
											<?php
487
												foreach ( $tax_rates as $rate ) {
488
													?>
489
													<tr>
490
														<td><?php echo esc_attr( $rate['country'] ); ?></td>
491
														<td><?php echo esc_attr( $rate['state'] ? $rate['state'] : '*' ); ?></td>
492
														<td><?php echo esc_attr( $rate['rate'] ); ?></td>
493
														<td><?php echo esc_attr( $rate['name'] ); ?></td>
494
														<td><?php echo empty( $rate['shipping'] ) ? '-' : '&#10004;'; ?></td>
495
													</tr>
496
													<?php
497
												}
498
											?>
499
										</tbody>
500
									</table>
501
									<p class="description"><?php _e( 'Please note: you may still need to add local and product specific tax rates depending on your business location. If in doubt, speak to an accountant.', 'woocommerce' ); ?></p>
502
								</div>
503
								<p class="description"><?php printf( __( 'You can edit tax rates later from the %1$stax settings%3$s screen and read more about taxes in %2$sour documentation%3$s.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=tax' ) . '" target="_blank">', '<a href="http://docs.woothemes.com/document/setting-up-taxes-in-woocommerce/" target="_blank">', '</a>' ); ?></p>
504
							</td>
505
						</tr>
506
						<?php
507
					}
508
				?>
509
			</table>
510
			<p class="wc-setup-actions step">
511
				<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" />
512
				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large button-next"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
513
				<?php wp_nonce_field( 'wc-setup' ); ?>
514
			</p>
515
		</form>
516
		<?php
517
	}
518
519
	/**
520
	 * Save shipping and tax options.
521
	 */
522
	public function wc_setup_shipping_taxes_save() {
523
		check_admin_referer( 'wc-setup' );
524
525
		$enable_shipping = isset( $_POST['woocommerce_calc_shipping'] );
526
		$enable_taxes    = isset( $_POST['woocommerce_calc_taxes'] );
527
528
		if ( $enable_shipping ) {
529
			update_option( 'woocommerce_ship_to_countries', '' );
530
		} else {
531
			update_option( 'woocommerce_ship_to_countries', 'disabled' );
532
		}
533
534
		update_option( 'woocommerce_calc_taxes', $enable_taxes ? 'yes' : 'no' );
535
		update_option( 'woocommerce_prices_include_tax', sanitize_text_field( $_POST['woocommerce_prices_include_tax'] ) );
536
537
		if ( $enable_shipping && ! empty( $_POST['shipping_cost_domestic'] ) ) {
538
			// Create a domestic shipping zone
539
			$zone = new WC_Shipping_Zone( $zone_data['zone_id'] );
540
			$zone->set_zone_name( __( 'Domestic', 'woocommerce' ) );
541
			$zone->set_zone_order( 1 );
542
			$zone->add_location( WC()->countries->get_base_country(), 'country' );
543
			$zone->save();
544
545
			// Add a flat rate shipping method to this domestic zone
546
			$instance_id     = $zone->add_shipping_method( 'flat_rate' );
547
			$shipping_method = new WC_Shipping_Flat_Rate( $instance_id );
548
			$option_key      = $shipping_method->get_instance_option_key();
549
550
			// Update rate settings
551
			$costs           = array();
552
			$costs[]         = wc_format_decimal( sanitize_text_field( $_POST['shipping_cost_domestic'] ) );
553
			if ( $item_cost = sanitize_text_field( $_POST['shipping_cost_domestic_item'] ) ) {
554
				$costs[] = $item_cost . ' * [qty]';
555
			}
556
			$shipping_method->instance_settings['cost']    = implode( ' + ', array_filter( $costs ) );
557
			$shipping_method->instance_settings['enabled'] = 'yes';
558
			$shipping_method->instance_settings['type']    = 'order';
559
			update_option( $option_key, $shipping_method->instance_settings );
560
		}
561
562
		if ( $enable_shipping && ! empty( $_POST['shipping_cost_worldwide'] ) ) {
563
			// Add a flat rate shipping method to the worldwide zone
564
			$zone            = WC_Shipping_Zones::get_zone( 0 );
565
			$instance_id     = $zone->add_shipping_method( 'flat_rate' );
566
			$shipping_method = new WC_Shipping_Flat_Rate( $instance_id );
567
			$option_key      = $shipping_method->get_instance_option_key();
568
569
			// Update rate settings
570
			$costs           = array();
571
			$costs[]         = wc_format_decimal( sanitize_text_field( $_POST['shipping_cost_worldwide'] ) );
572
			if ( $item_cost = sanitize_text_field( $_POST['shipping_cost_worldwide_item'] ) ) {
573
				$costs[] = $item_cost . ' * [qty]';
574
			}
575
			$shipping_method->instance_settings['cost']    = implode( ' + ', array_filter( $costs ) );
576
			$shipping_method->instance_settings['enabled'] = 'yes';
577
			$shipping_method->instance_settings['type']    = 'order';
578
			update_option( $option_key, $shipping_method->instance_settings );
579
		}
580
581
		if ( $enable_taxes && ! empty( $_POST['woocommerce_import_tax_rates'] ) ) {
582
			$locale_info = include( WC()->plugin_path() . '/i18n/locale-info.php' );
583
			$tax_rates   = array();
584
			$country     = WC()->countries->get_base_country();
585
			$state       = WC()->countries->get_base_state();
586
587 View Code Duplication
			if ( isset( $locale_info[ $country ] ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
588
				if ( isset( $locale_info[ $country ]['tax_rates'][ $state ] ) ) {
589
					$tax_rates = $locale_info[ $country ]['tax_rates'][ $state ];
590
				} elseif ( isset( $locale_info[ $country ]['tax_rates'][''] ) ) {
591
					$tax_rates = $locale_info[ $country ]['tax_rates'][''];
592
				}
593
				if ( isset( $locale_info[ $country ]['tax_rates']['*'] ) ) {
594
					$tax_rates = array_merge( $locale_info[ $country ]['tax_rates']['*'], $tax_rates );
595
				}
596
			}
597
			if ( $tax_rates ) {
598
				$loop = 0;
599
				foreach ( $tax_rates as $rate ) {
600
					$tax_rate = array(
601
						'tax_rate_country'  => $rate['country'],
602
						'tax_rate_state'    => $rate['state'],
603
						'tax_rate'          => $rate['rate'],
604
						'tax_rate_name'     => $rate['name'],
605
						'tax_rate_priority' => isset( $rate['priority'] ) ? absint( $rate['priority'] ) : 1,
606
						'tax_rate_compound' => 0,
607
						'tax_rate_shipping' => $rate['shipping'] ? 1 : 0,
608
						'tax_rate_order'    => $loop ++,
609
						'tax_rate_class'    => ''
610
					);
611
					WC_Tax::_insert_tax_rate( $tax_rate );
612
				}
613
			}
614
		}
615
616
		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
617
		exit;
618
	}
619
620
	/**
621
	 * Payments Step.
622
	 */
623
	public function wc_setup_payments() {
624
		$paypal_settings = array_filter( (array) get_option( 'woocommerce_paypal_settings', array() ) );
625
		$cheque_settings = array_filter( (array) get_option( 'woocommerce_cheque_settings', array() ) );
626
		$cod_settings    = array_filter( (array) get_option( 'woocommerce_cod_settings', array() ) );
627
		$bacs_settings   = array_filter( (array) get_option( 'woocommerce_bacs_settings', array() ) );
628
		?>
629
		<h1><?php _e( 'Payments', 'woocommerce' ); ?></h1>
630
		<form method="post">
631
			<p><?php printf( __( 'WooCommerce can accept both online and offline payments. %2$sAdditional payment methods%3$s can be installed later and managed from the %1$scheckout settings%3$s screen.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout' ) . '" target="_blank">', '<a href="' . admin_url( 'admin.php?page=wc-addons&view=payment-gateways' ) . '" target="_blank">', '</a>' ); ?></p>
632
			<table class="form-table">
633
				<tr class="section_title">
634
					<td colspan="2">
635
						<h2><?php _e( 'PayPal Standard', 'woocommerce' ); ?></h2>
636
						<p><?php _e( 'To accept payments via PayPal on your store, simply enter your PayPal email address below.', 'woocommerce' ); ?></p>
637
					</td>
638
				</tr>
639
				<tr>
640
					<th scope="row"><label for="woocommerce_paypal_email"><?php _e( 'PayPal Email Address:', 'woocommerce' ); ?></label></th>
641
					<td>
642
						<input type="email" id="woocommerce_paypal_email" name="woocommerce_paypal_email" class="input-text" value="<?php echo esc_attr( isset( $paypal_settings['email'] ) ? $paypal_settings['email'] : '' ); ?>" />
643
					</td>
644
				</tr>
645
				<tr class="section_title">
646
					<td colspan="2">
647
						<h2><?php _e( 'Offline Payments', 'woocommerce' ); ?></h2>
648
						<p><?php _e( 'Offline gateways require manual processing, but can be useful in certain circumstances or for testing payments.', 'woocommerce' ); ?></p>
649
					</td>
650
				</tr>
651
				<tr>
652
					<th scope="row"><label for="woocommerce_enable_cheque"><?php _e( 'Cheque Payments', 'woocommerce' ); ?></label></th>
653
					<td>
654
						<label><input type="checkbox" id="woocommerce_enable_cheque" name="woocommerce_enable_cheque" class="input-checkbox" value="yes" <?php checked( ( isset( $cheque_settings['enabled'] ) && 'yes' === $cheque_settings['enabled'] ), true ); ?> /> <?php _e( 'Enable payment via Cheques', 'woocommerce' ); ?></label>
655
					</td>
656
				</tr>
657
				<tr>
658
					<th scope="row"><label for="woocommerce_enable_cod"><?php _e( 'Cash on Delivery', 'woocommerce' ); ?></label></th>
659
					<td>
660
						<label><input type="checkbox" id="woocommerce_enable_cod" name="woocommerce_enable_cod" class="input-checkbox" value="yes" <?php checked( ( isset( $cod_settings['enabled'] ) && 'yes' === $cod_settings['enabled'] ), true ); ?> /> <?php _e( 'Enable cash on delivery', 'woocommerce' ); ?></label>
661
					</td>
662
				</tr>
663
				<tr>
664
					<th scope="row"><label for="woocommerce_enable_bacs"><?php _e( 'Bank Transfer (BACS)', 'woocommerce' ); ?></label></th>
665
					<td>
666
						<label><input type="checkbox" id="woocommerce_enable_bacs" name="woocommerce_enable_bacs" class="input-checkbox" value="yes" <?php checked( ( isset( $bacs_settings['enabled'] ) && 'yes' === $bacs_settings['enabled'] ), true ); ?> /> <?php _e( 'Enable BACS payments', 'woocommerce' ); ?></label>
667
					</td>
668
				</tr>
669
			</table>
670
			<p class="wc-setup-actions step">
671
				<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" />
672
				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large button-next"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
673
				<?php wp_nonce_field( 'wc-setup' ); ?>
674
			</p>
675
		</form>
676
		<?php
677
	}
678
679
	/**
680
	 * Payments Step save.
681
	 */
682
	public function wc_setup_payments_save() {
683
		check_admin_referer( 'wc-setup' );
684
685
		$paypal_settings            = array_filter( (array) get_option( 'woocommerce_paypal_settings', array() ) );
686
		$cheque_settings            = array_filter( (array) get_option( 'woocommerce_cheque_settings', array() ) );
687
		$cod_settings               = array_filter( (array) get_option( 'woocommerce_cod_settings', array() ) );
688
		$bacs_settings              = array_filter( (array) get_option( 'woocommerce_bacs_settings', array() ) );
689
690
		$paypal_settings['enabled'] = ! empty( $_POST['woocommerce_paypal_email'] ) ? 'yes' : 'no';
691
		$cheque_settings['enabled'] = isset( $_POST['woocommerce_enable_cheque'] ) ? 'yes' : 'no';
692
		$cod_settings['enabled']    = isset( $_POST['woocommerce_enable_cod'] ) ? 'yes' : 'no';
693
		$bacs_settings['enabled']   = isset( $_POST['woocommerce_enable_bacs'] ) ? 'yes' : 'no';
694
695
		if ( ! empty( $_POST['woocommerce_paypal_email'] ) ) {
696
			$paypal_settings['email'] = wc_clean( $_POST['woocommerce_paypal_email'] );
697
		}
698
699
		update_option( 'woocommerce_paypal_settings', $paypal_settings );
700
		update_option( 'woocommerce_cheque_settings', $cheque_settings );
701
		update_option( 'woocommerce_cod_settings', $cod_settings );
702
		update_option( 'woocommerce_bacs_settings', $bacs_settings );
703
704
		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
705
		exit;
706
	}
707
708
	/**
709
	 * Actions on the final step.
710
	 */
711
	private function wc_setup_ready_actions() {
712
		WC_Admin_Notices::remove_notice( 'install' );
713
714
		if ( isset( $_GET['wc_tracker_optin'] ) && isset( $_GET['wc_tracker_nonce'] ) && wp_verify_nonce( $_GET['wc_tracker_nonce'], 'wc_tracker_optin' ) ) {
715
			update_option( 'woocommerce_allow_tracking', 'yes' );
716
			WC_Tracker::send_tracking_data( true );
717
718
		} elseif ( isset( $_GET['wc_tracker_optout'] ) && isset( $_GET['wc_tracker_nonce'] ) && wp_verify_nonce( $_GET['wc_tracker_nonce'], 'wc_tracker_optout' ) ) {
719
			update_option( 'woocommerce_allow_tracking', 'no' );
720
		}
721
	}
722
723
	/**
724
	 * Final step.
725
	 */
726
	public function wc_setup_ready() {
727
		$this->wc_setup_ready_actions();
728
		shuffle( $this->tweets );
729
		?>
730
		<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="<?php echo esc_attr( $this->tweets[0] ); ?>" data-via="WooThemes" data-size="large">Tweet</a>
731
		<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
732
733
		<h1><?php _e( 'Your Store is Ready!', 'woocommerce' ); ?></h1>
734
735
		<?php if ( 'unknown' === get_option( 'woocommerce_allow_tracking', 'unknown' ) ) : ?>
736
			<div class="woocommerce-message woocommerce-tracker">
737
				<p><?php printf( __( 'Want to help make WooCommerce even more awesome? Allow WooThemes to collect non-sensitive diagnostic data and usage information, and get %s discount on your next WooThemes purchase. %sFind out more%s.', 'woocommerce' ), '20%', '<a href="http://www.woothemes.com/woocommerce/usage-tracking/" target="_blank">', '</a>' ); ?></p>
738
				<p class="submit">
739
					<a class="button-primary button button-large" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc_tracker_optin', 'true' ), 'wc_tracker_optin', 'wc_tracker_nonce' ) ); ?>"><?php _e( 'Allow', 'woocommerce' ); ?></a>
740
					<a class="button-secondary button button-large skip"  href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc_tracker_optout', 'true' ), 'wc_tracker_optout', 'wc_tracker_nonce' ) ); ?>"><?php _e( 'No thanks', 'woocommerce' ); ?></a>
741
				</p>
742
			</div>
743
		<?php endif; ?>
744
745
		<div class="wc-setup-next-steps">
746
			<div class="wc-setup-next-steps-first">
747
				<h2><?php _e( 'Next Steps', 'woocommerce' ); ?></h2>
748
				<ul>
749
					<li class="setup-product"><a class="button button-primary button-large" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=product&tutorial=true' ) ); ?>"><?php _e( 'Create your first product!', 'woocommerce' ); ?></a></li>
750
				</ul>
751
			</div>
752
			<div class="wc-setup-next-steps-last">
753
				<h2><?php _e( 'Learn More', 'woocommerce' ); ?></h2>
754
				<ul>
755
					<li class="video-walkthrough"><a href="http://docs.woothemes.com/document/woocommerce-101-video-series/?utm_source=WooCommercePlugin&amp;utm_medium=Wizard&amp;utm_content=Videos&amp;utm_campaign=Onboarding"><?php _e( 'Watch the WC 101 video walkthroughs', 'woocommerce' ); ?></a></li>
756
					<li class="newsletter"><a href="http://www.woothemes.com/woocommerce-onboarding-email/?utm_source=WooCommercePlugin&amp;utm_medium=Wizard&amp;utm_content=Newsletter&amp;utm_campaign=Onboarding"><?php _e( 'Get eCommerce advice in your inbox', 'woocommerce' ); ?></a></li>
757
					<li class="sidekick"><a href="http://www.woothemes.com/sidekick/"><?php _e( 'Follow Sidekick interactive walkthroughs', 'woocommerce' ); ?></a></li>
758
					<li class="learn-more"><a href="http://docs.woothemes.com/documentation/plugins/woocommerce/getting-started/?utm_source=WooCommercePlugin&amp;utm_medium=Wizard&amp;utm_content=Docs&amp;utm_campaign=Onboarding"><?php _e( 'Read more about getting started', 'woocommerce' ); ?></a></li>
759
				</ul>
760
			</div>
761
		</div>
762
		<?php
763
	}
764
}
765
766
new WC_Admin_Setup_Wizard();
767