class-wc-admin-setup-wizard.php
85.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
<?php
/**
* Setup Wizard Class
*
* Takes new users through some basic steps to setup their store.
*
* @package WooCommerce\Admin
* @version 2.6.0
* @deprecated 4.6.0
*/
use Automattic\Jetpack\Constants;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Admin_Setup_Wizard class.
*/
class WC_Admin_Setup_Wizard {
/**
* Current step
*
* @var string
*/
private $step = '';
/**
* Steps for the setup wizard
*
* @var array
*/
private $steps = array();
/**
* Actions to be executed after the HTTP response has completed
*
* @var array
*/
private $deferred_actions = array();
/**
* Tweets user can optionally send after install
*
* @var array
*/
private $tweets = array(
'Someone give me woo-t, I just set up a new store with #WordPress and @WooCommerce!',
'Someone give me high five, I just set up a new store with #WordPress and @WooCommerce!',
);
/**
* The version of WordPress required to run the WooCommerce Admin plugin
*
* @var string
*/
private $wc_admin_plugin_minimum_wordpress_version = '5.3';
/**
* Hook in tabs.
*
* @deprecated 4.6.0
*/
public function __construct() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
/**
* Add admin menus/screens.
*
* @deprecated 4.6.0
*/
public function admin_menus() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
add_dashboard_page( '', '', 'manage_options', 'wc-setup', '' );
}
/**
* The theme "extra" should only be shown if the current user can modify themes
* and the store doesn't already have a WooCommerce theme.
*
* @deprecated 4.6.0
* @return boolean
*/
protected function should_show_theme() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$support_woocommerce = current_theme_supports( 'woocommerce' ) && ! wc_is_wp_default_theme_active();
return (
current_user_can( 'install_themes' ) &&
current_user_can( 'switch_themes' ) &&
! is_multisite() &&
! $support_woocommerce
);
}
/**
* The "automated tax" extra should only be shown if the current user can
* install plugins and the store is in a supported country.
*
* @deprecated 4.6.0
*/
protected function should_show_automated_tax() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
if ( ! current_user_can( 'install_plugins' ) ) {
return false;
}
$country_code = WC()->countries->get_base_country();
// https://developers.taxjar.com/api/reference/#countries .
$tax_supported_countries = array_merge(
array( 'US', 'CA', 'AU', 'GB' ),
WC()->countries->get_european_union_countries()
);
return in_array( $country_code, $tax_supported_countries, true );
}
/**
* Should we show the MailChimp install option?
* True only if the user can install plugins.
*
* @deprecated 4.6.0
* @return boolean
*/
protected function should_show_mailchimp() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
return current_user_can( 'install_plugins' );
}
/**
* Should we show the Facebook install option?
* True only if the user can install plugins,
* and up until the end date of the recommendation.
*
* @deprecated 4.6.0
* @return boolean
*/
protected function should_show_facebook() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
return current_user_can( 'install_plugins' );
}
/**
* Is the WooCommerce Admin actively included in the WooCommerce core?
* Based on presence of a basic WC Admin function.
*
* @deprecated 4.6.0
* @return boolean
*/
protected function is_wc_admin_active() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
return function_exists( 'wc_admin_url' );
}
/**
* Should we show the WooCommerce Admin install option?
* True only if the user can install plugins,
* and is running the correct version of WordPress.
*
* @see WC_Admin_Setup_Wizard::$wc_admin_plugin_minimum_wordpress_version
*
* @deprecated 4.6.0
* @return boolean
*/
protected function should_show_wc_admin() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$wordpress_minimum_met = version_compare( get_bloginfo( 'version' ), $this->wc_admin_plugin_minimum_wordpress_version, '>=' );
return current_user_can( 'install_plugins' ) && $wordpress_minimum_met && ! $this->is_wc_admin_active();
}
/**
* Should we show the new WooCommerce Admin onboarding experience?
*
* @deprecated 4.6.0
* @return boolean
*/
protected function should_show_wc_admin_onboarding() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
// As of WooCommerce 4.1, all new sites should use the latest OBW from wc-admin package.
// This filter will allow for forcing the old wizard while we migrate e2e tests.
return ! apply_filters( 'woocommerce_setup_wizard_force_legacy', false );
}
/**
* Should we display the 'Recommended' step?
* True if at least one of the recommendations will be displayed.
*
* @deprecated 4.6.0
* @return boolean
*/
protected function should_show_recommended_step() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
return $this->should_show_theme()
|| $this->should_show_automated_tax()
|| $this->should_show_mailchimp()
|| $this->should_show_facebook()
|| $this->should_show_wc_admin();
}
/**
* Register/enqueue scripts and styles for the Setup Wizard.
*
* Hooked onto 'admin_enqueue_scripts'.
*
* @deprecated 4.6.0
*/
public function enqueue_scripts() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
/**
* Show the setup wizard.
*
* @deprecated 4.6.0
*/
public function setup_wizard() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
if ( empty( $_GET['page'] ) || 'wc-setup' !== $_GET['page'] ) { // WPCS: CSRF ok, input var ok.
return;
}
$default_steps = array(
'new_onboarding' => array(
'name' => '',
'view' => array( $this, 'wc_setup_new_onboarding' ),
'handler' => array( $this, 'wc_setup_new_onboarding_save' ),
),
'store_setup' => array(
'name' => __( 'Store setup', 'woocommerce' ),
'view' => array( $this, 'wc_setup_store_setup' ),
'handler' => array( $this, 'wc_setup_store_setup_save' ),
),
'payment' => array(
'name' => __( 'Payment', 'woocommerce' ),
'view' => array( $this, 'wc_setup_payment' ),
'handler' => array( $this, 'wc_setup_payment_save' ),
),
'shipping' => array(
'name' => __( 'Shipping', 'woocommerce' ),
'view' => array( $this, 'wc_setup_shipping' ),
'handler' => array( $this, 'wc_setup_shipping_save' ),
),
'recommended' => array(
'name' => __( 'Recommended', 'woocommerce' ),
'view' => array( $this, 'wc_setup_recommended' ),
'handler' => array( $this, 'wc_setup_recommended_save' ),
),
'activate' => array(
'name' => __( 'Activate', 'woocommerce' ),
'view' => array( $this, 'wc_setup_activate' ),
'handler' => array( $this, 'wc_setup_activate_save' ),
),
'next_steps' => array(
'name' => __( 'Ready!', 'woocommerce' ),
'view' => array( $this, 'wc_setup_ready' ),
'handler' => '',
),
);
// Hide the new/improved onboarding experience screen if the user is not part of the a/b test.
if ( ! $this->should_show_wc_admin_onboarding() ) {
unset( $default_steps['new_onboarding'] );
}
// Hide recommended step if nothing is going to be shown there.
if ( ! $this->should_show_recommended_step() ) {
unset( $default_steps['recommended'] );
}
// Hide shipping step if the store is selling digital products only.
if ( 'virtual' === get_option( 'woocommerce_product_type' ) ) {
unset( $default_steps['shipping'] );
}
// Hide activate section when the user does not have capabilities to install plugins, think multiside admins not being a super admin.
if ( ! current_user_can( 'install_plugins' ) ) {
unset( $default_steps['activate'] );
}
$this->steps = apply_filters( 'woocommerce_setup_wizard_steps', $default_steps );
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); // WPCS: CSRF ok, input var ok.
// @codingStandardsIgnoreStart
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
call_user_func( $this->steps[ $this->step ]['handler'], $this );
}
// @codingStandardsIgnoreEnd
ob_start();
$this->setup_wizard_header();
$this->setup_wizard_steps();
$this->setup_wizard_content();
$this->setup_wizard_footer();
exit;
}
/**
* Get the URL for the next step's screen.
*
* @param string $step slug (default: current step).
* @return string URL for next step if a next step exists.
* Admin URL if it's the last step.
* Empty string on failure.
*
* @deprecated 4.6.0
* @since 3.0.0
*/
public function get_next_step_link( $step = '' ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
if ( ! $step ) {
$step = $this->step;
}
$keys = array_keys( $this->steps );
if ( end( $keys ) === $step ) {
return admin_url();
}
$step_index = array_search( $step, $keys, true );
if ( false === $step_index ) {
return '';
}
return add_query_arg( 'step', $keys[ $step_index + 1 ], remove_query_arg( 'activate_error' ) );
}
/**
* Setup Wizard Header.
*
* @deprecated 4.6.0
*/
public function setup_wizard_header() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
// same as default WP from wp-admin/admin-header.php.
$wp_version_class = 'branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) );
set_current_screen();
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php esc_html_e( 'WooCommerce › Setup Wizard', 'woocommerce' ); ?></title>
<?php do_action( 'admin_enqueue_scripts' ); ?>
<?php wp_print_scripts( 'wc-setup' ); ?>
<?php do_action( 'admin_print_styles' ); ?>
<?php do_action( 'admin_head' ); ?>
</head>
<body class="wc-setup wp-core-ui <?php echo esc_attr( 'wc-setup-step__' . $this->step ); ?> <?php echo esc_attr( $wp_version_class ); ?>">
<h1 class="wc-logo"><a href="https://woocommerce.com/"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/woocommerce_logo.png" alt="<?php esc_attr_e( 'WooCommerce', 'woocommerce' ); ?>" /></a></h1>
<?php
}
/**
* Setup Wizard Footer.
*
* @deprecated 4.6.0
*/
public function setup_wizard_footer() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$current_step = $this->step;
?>
<?php if ( 'new_onboarding' === $current_step || 'store-setup' === $current_step ) : ?>
<a class="wc-setup-footer-links" href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Not right now', 'woocommerce' ); ?></a>
<?php elseif ( 'recommended' === $current_step || 'activate' === $current_step ) : ?>
<a class="wc-setup-footer-links" href="<?php echo esc_url( $this->get_next_step_link() ); ?>"><?php esc_html_e( 'Skip this step', 'woocommerce' ); ?></a>
<?php endif; ?>
<?php do_action( 'woocommerce_setup_footer' ); ?>
</body>
</html>
<?php
}
/**
* Output the steps.
*
* @deprecated 4.6.0
*/
public function setup_wizard_steps() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$output_steps = $this->steps;
$selected_features = array_filter( $this->wc_setup_activate_get_feature_list() );
// Hide the activate step if Jetpack is already active, unless WooCommerce Services
// features are selected, or unless the Activate step was already taken.
if ( class_exists( 'Jetpack' ) && Jetpack::is_active() && empty( $selected_features ) && 'yes' !== get_transient( 'wc_setup_activated' ) ) {
unset( $output_steps['activate'] );
}
unset( $output_steps['new_onboarding'] );
?>
<ol class="wc-setup-steps">
<?php
foreach ( $output_steps as $step_key => $step ) {
$is_completed = array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true );
if ( $step_key === $this->step ) {
?>
<li class="active"><?php echo esc_html( $step['name'] ); ?></li>
<?php
} elseif ( $is_completed ) {
?>
<li class="done">
<a href="<?php echo esc_url( add_query_arg( 'step', $step_key, remove_query_arg( 'activate_error' ) ) ); ?>"><?php echo esc_html( $step['name'] ); ?></a>
</li>
<?php
} else {
?>
<li><?php echo esc_html( $step['name'] ); ?></li>
<?php
}
}
?>
</ol>
<?php
}
/**
* Output the content for the current step.
*
* @deprecated 4.6.0
*/
public function setup_wizard_content() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
echo '<div class="wc-setup-content">';
if ( ! empty( $this->steps[ $this->step ]['view'] ) ) {
call_user_func( $this->steps[ $this->step ]['view'], $this );
}
echo '</div>';
}
/**
* Display's a prompt for users to try out the new improved WooCommerce onboarding experience in WooCommerce Admin.
*
* @deprecated 4.6.0
*/
public function wc_setup_new_onboarding() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
?>
<div class="wc-setup-step__new_onboarding-wrapper">
<p class="wc-setup-step__new_onboarding-welcome"><?php esc_html_e( 'Welcome to', 'woocommerce' ); ?></p>
<h1 class="wc-logo"><a href="https://woocommerce.com/"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/woocommerce_logo.png" alt="<?php esc_attr_e( 'WooCommerce', 'woocommerce' ); ?>" /></a></h1>
<p><?php esc_html_e( 'Get your store up and running more quickly with our new and improved setup experience', 'woocommerce' ); ?></p>
<form method="post" class="activate-new-onboarding">
<?php wp_nonce_field( 'wc-setup' ); ?>
<input type="hidden" name="save_step" value="new_onboarding" />
<p class="wc-setup-actions step">
<button class="button-primary button button-large" value="<?php esc_attr_e( 'Yes please', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Yes please', 'woocommerce' ); ?></button>
</p>
</form>
<?php if ( ! $this->is_wc_admin_active() ) : ?>
<p class="wc-setup-step__new_onboarding-plugin-info"><?php esc_html_e( 'The "WooCommerce Admin" plugin will be installed and activated', 'woocommerce' ); ?></p>
<?php endif; ?>
</div>
<?php
}
/**
* Installs WooCommerce admin and redirects to the new onboarding experience.
*
* @deprecated 4.6.0
*/
public function wc_setup_new_onboarding_save() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
/**
* Initial "store setup" step.
* Location, product type, page setup, and tracking opt-in.
*/
public function wc_setup_store_setup() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$address = WC()->countries->get_base_address();
$address_2 = WC()->countries->get_base_address_2();
$city = WC()->countries->get_base_city();
$state = WC()->countries->get_base_state();
$country = WC()->countries->get_base_country();
$postcode = WC()->countries->get_base_postcode();
$currency = get_option( 'woocommerce_currency', 'USD' );
$product_type = get_option( 'woocommerce_product_type', 'both' );
$sell_in_person = get_option( 'woocommerce_sell_in_person', 'none_selected' );
if ( empty( $country ) ) {
$user_location = WC_Geolocation::geolocate_ip();
$country = $user_location['country'];
$state = $user_location['state'];
}
$locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
$currency_by_country = wp_list_pluck( $locale_info, 'currency_code' );
?>
<form method="post" class="address-step">
<input type="hidden" name="save_step" value="store_setup" />
<?php wp_nonce_field( 'wc-setup' ); ?>
<p class="store-setup"><?php esc_html_e( 'The following wizard will help you configure your store and get you started quickly.', 'woocommerce' ); ?></p>
<div class="store-address-container">
<label for="store_country" class="location-prompt"><?php esc_html_e( 'Where is your store based?', 'woocommerce' ); ?></label>
<select id="store_country" name="store_country" required data-placeholder="<?php esc_attr_e( 'Choose a country / region…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'Country / Region', 'woocommerce' ); ?>" class="location-input wc-enhanced-select dropdown">
<?php foreach ( WC()->countries->get_countries() as $code => $label ) : ?>
<option <?php selected( $code, $country ); ?> value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<label class="location-prompt" for="store_address"><?php esc_html_e( 'Address', 'woocommerce' ); ?></label>
<input type="text" id="store_address" class="location-input" name="store_address" required value="<?php echo esc_attr( $address ); ?>" />
<label class="location-prompt" for="store_address_2"><?php esc_html_e( 'Address line 2', 'woocommerce' ); ?></label>
<input type="text" id="store_address_2" class="location-input" name="store_address_2" value="<?php echo esc_attr( $address_2 ); ?>" />
<div class="city-and-postcode">
<div>
<label class="location-prompt" for="store_city"><?php esc_html_e( 'City', 'woocommerce' ); ?></label>
<input type="text" id="store_city" class="location-input" name="store_city" required value="<?php echo esc_attr( $city ); ?>" />
</div>
<div class="store-state-container hidden">
<label for="store_state" class="location-prompt">
<?php esc_html_e( 'State', 'woocommerce' ); ?>
</label>
<select id="store_state" name="store_state" data-placeholder="<?php esc_attr_e( 'Choose a state…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'State', 'woocommerce' ); ?>" class="location-input wc-enhanced-select dropdown"></select>
</div>
<div>
<label class="location-prompt" for="store_postcode"><?php esc_html_e( 'Postcode / ZIP', 'woocommerce' ); ?></label>
<input type="text" id="store_postcode" class="location-input" name="store_postcode" required value="<?php echo esc_attr( $postcode ); ?>" />
</div>
</div>
</div>
<div class="store-currency-container">
<label class="location-prompt" for="currency_code">
<?php esc_html_e( 'What currency do you accept payments in?', 'woocommerce' ); ?>
</label>
<select
id="currency_code"
name="currency_code"
required
data-placeholder="<?php esc_attr_e( 'Choose a currency…', 'woocommerce' ); ?>"
class="location-input wc-enhanced-select dropdown"
>
<option value=""><?php esc_html_e( 'Choose a currency…', 'woocommerce' ); ?></option>
<?php foreach ( get_woocommerce_currencies() as $code => $name ) : ?>
<option value="<?php echo esc_attr( $code ); ?>" <?php selected( $currency, $code ); ?>>
<?php
$symbol = get_woocommerce_currency_symbol( $code );
if ( $symbol === $code ) {
/* translators: 1: currency name 2: currency code */
echo esc_html( sprintf( __( '%1$s (%2$s)', 'woocommerce' ), $name, $code ) );
} else {
/* translators: 1: currency name 2: currency symbol, 3: currency code */
echo esc_html( sprintf( __( '%1$s (%2$s %3$s)', 'woocommerce' ), $name, get_woocommerce_currency_symbol( $code ), $code ) );
}
?>
</option>
<?php endforeach; ?>
</select>
<script type="text/javascript">
var wc_setup_currencies = JSON.parse( decodeURIComponent( '<?php echo rawurlencode( wp_json_encode( $currency_by_country ) ); ?>' ) );
var wc_base_state = "<?php echo esc_js( $state ); ?>";
</script>
</div>
<div class="product-type-container">
<label class="location-prompt" for="product_type">
<?php esc_html_e( 'What type of products do you plan to sell?', 'woocommerce' ); ?>
</label>
<select id="product_type" name="product_type" required class="location-input wc-enhanced-select dropdown">
<option value="both" <?php selected( $product_type, 'both' ); ?>><?php esc_html_e( 'I plan to sell both physical and digital products', 'woocommerce' ); ?></option>
<option value="physical" <?php selected( $product_type, 'physical' ); ?>><?php esc_html_e( 'I plan to sell physical products', 'woocommerce' ); ?></option>
<option value="virtual" <?php selected( $product_type, 'virtual' ); ?>><?php esc_html_e( 'I plan to sell digital products', 'woocommerce' ); ?></option>
</select>
</div>
<div class="sell-in-person-container">
<input
type="checkbox"
id="woocommerce_sell_in_person"
name="sell_in_person"
value="yes"
<?php checked( $sell_in_person, true ); ?>
/>
<label class="location-prompt" for="woocommerce_sell_in_person">
<?php esc_html_e( 'I will also be selling products or services in person.', 'woocommerce' ); ?>
</label>
</div>
<input type="checkbox" id="wc_tracker_checkbox" name="wc_tracker_checkbox" value="yes" <?php checked( 'yes', get_option( 'woocommerce_allow_tracking', 'no' ) ); ?> />
<?php $this->tracking_modal(); ?>
<p class="wc-setup-actions step">
<button class="button-primary button button-large" value="<?php esc_attr_e( "Let's go!", 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( "Let's go!", 'woocommerce' ); ?></button>
</p>
</form>
<?php
}
/**
* Template for the usage tracking modal.
*
* @deprecated 4.6.0
*/
public function tracking_modal() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
?>
<script type="text/template" id="tmpl-wc-modal-tracking-setup">
<div class="wc-backbone-modal woocommerce-tracker">
<div class="wc-backbone-modal-content">
<section class="wc-backbone-modal-main" role="main">
<header class="wc-backbone-modal-header">
<h1><?php esc_html_e( 'Help improve WooCommerce with usage tracking', 'woocommerce' ); ?></h1>
</header>
<article>
<p>
<?php
printf(
wp_kses(
/* translators: %1$s: usage tracking help link */
__( 'Learn more about how usage tracking works, and how you\'ll be helping in our <a href="%1$s" target="_blank">usage tracking documentation</a>.', 'woocommerce' ),
array(
'a' => array(
'href' => array(),
'target' => array(),
),
)
),
'https://woocommerce.com/usage-tracking/'
);
?>
</p>
<p class="woocommerce-tracker-checkbox">
<input type="checkbox" id="wc_tracker_checkbox_dialog" name="wc_tracker_checkbox_dialog" value="yes" <?php checked( 'yes', get_option( 'woocommerce_allow_tracking', 'no' ) ); ?> />
<label for="wc_tracker_checkbox_dialog"><?php esc_html_e( 'Enable usage tracking and help improve WooCommerce', 'woocommerce' ); ?></label>
</p>
</article>
<footer>
<div class="inner">
<button class="button button-primary button-large" id="wc_tracker_submit" aria-label="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
</div>
</footer>
</section>
</div>
</div>
<div class="wc-backbone-modal-backdrop modal-close"></div>
</script>
<?php
}
/**
* Save initial store settings.
*
* @deprecated 4.6.0
*/
public function wc_setup_store_setup_save() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
/**
* Finishes replying to the client, but keeps the process running for further (async) code execution.
*
* @see https://core.trac.wordpress.org/ticket/41358 .
*/
protected function close_http_connection() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
// Only 1 PHP process can access a session object at a time, close this so the next request isn't kept waiting.
// @codingStandardsIgnoreStart
if ( session_id() ) {
session_write_close();
}
// @codingStandardsIgnoreEnd
wc_set_time_limit( 0 );
// fastcgi_finish_request is the cleanest way to send the response and keep the script running, but not every server has it.
if ( is_callable( 'fastcgi_finish_request' ) ) {
fastcgi_finish_request();
} else {
// Fallback: send headers and flush buffers.
if ( ! headers_sent() ) {
header( 'Connection: close' );
}
@ob_end_flush(); // @codingStandardsIgnoreLine.
flush();
}
}
/**
* Function called after the HTTP request is finished, so it's executed without the client having to wait for it.
*
* @see WC_Admin_Setup_Wizard::install_plugin
* @see WC_Admin_Setup_Wizard::install_theme
*
* @deprecated 4.6.0
*/
public function run_deferred_actions() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$this->close_http_connection();
foreach ( $this->deferred_actions as $action ) {
$action['func']( ...$action['args'] );
// Clear the background installation flag if this is a plugin.
if (
isset( $action['func'][1] ) &&
'background_installer' === $action['func'][1] &&
isset( $action['args'][0] )
) {
delete_option( 'woocommerce_setup_background_installing_' . $action['args'][0] );
}
}
}
/**
* Helper method to queue the background install of a plugin.
*
* @param string $plugin_id Plugin id used for background install.
* @param array $plugin_info Plugin info array containing name and repo-slug, and optionally file if different from [repo-slug].php.
*
* @deprecated 4.6.0
*/
protected function install_plugin( $plugin_id, $plugin_info ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
// Make sure we don't trigger multiple simultaneous installs.
if ( get_option( 'woocommerce_setup_background_installing_' . $plugin_id ) ) {
return;
}
$plugin_file = isset( $plugin_info['file'] ) ? $plugin_info['file'] : $plugin_info['repo-slug'] . '.php';
if ( is_plugin_active( $plugin_info['repo-slug'] . '/' . $plugin_file ) ) {
return;
}
if ( empty( $this->deferred_actions ) ) {
add_action( 'shutdown', array( $this, 'run_deferred_actions' ) );
}
array_push(
$this->deferred_actions,
array(
'func' => array( 'WC_Install', 'background_installer' ),
'args' => array( $plugin_id, $plugin_info ),
)
);
// Set the background installation flag for this plugin.
update_option( 'woocommerce_setup_background_installing_' . $plugin_id, true );
}
/**
* Helper method to queue the background install of a theme.
*
* @param string $theme_id Theme id used for background install.
*
* @deprecated 4.6.0
*/
protected function install_theme( $theme_id ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
if ( empty( $this->deferred_actions ) ) {
add_action( 'shutdown', array( $this, 'run_deferred_actions' ) );
}
array_push(
$this->deferred_actions,
array(
'func' => array( 'WC_Install', 'theme_background_installer' ),
'args' => array( $theme_id ),
)
);
}
/**
* Helper method to install Jetpack.
*
* @deprecated 4.6.0
*/
protected function install_jetpack() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$this->install_plugin(
'jetpack',
array(
'name' => __( 'Jetpack', 'woocommerce' ),
'repo-slug' => 'jetpack',
)
);
}
/**
* Helper method to install WooCommerce Services and its Jetpack dependency.
*
* @deprecated 4.6.0
*/
protected function install_woocommerce_services() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$this->install_jetpack();
$this->install_plugin(
'woocommerce-services',
array(
'name' => __( 'WooCommerce Services', 'woocommerce' ),
'repo-slug' => 'woocommerce-services',
)
);
}
/**
* Retrieve info for missing WooCommerce Services and/or Jetpack plugin.
*
* @deprecated 4.6.0
* @return array
*/
protected function get_wcs_requisite_plugins() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$plugins = array();
if ( ! is_plugin_active( 'woocommerce-services/woocommerce-services.php' ) && ! get_option( 'woocommerce_setup_background_installing_woocommerce-services' ) ) {
$plugins[] = array(
'name' => __( 'WooCommerce Services', 'woocommerce' ),
'slug' => 'woocommerce-services',
);
}
if ( ! is_plugin_active( 'jetpack/jetpack.php' ) && ! get_option( 'woocommerce_setup_background_installing_jetpack' ) ) {
$plugins[] = array(
'name' => __( 'Jetpack', 'woocommerce' ),
'slug' => 'jetpack',
);
}
return $plugins;
}
/**
* Plugin install info message markup with heading.
*
* @deprecated 4.6.0
*/
public function plugin_install_info() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
?>
<span class="plugin-install-info">
<span class="plugin-install-info-label"><?php esc_html_e( 'The following plugins will be installed and activated for you:', 'woocommerce' ); ?></span>
<span class="plugin-install-info-list"></span>
</span>
<?php
}
/**
* Get shipping methods based on country code.
*
* @param string $country_code Country code.
* @param string $currency_code Currency code.
*
* @deprecated 4.6.0
* @return array
*/
protected function get_wizard_shipping_methods( $country_code, $currency_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$shipping_methods = array(
'flat_rate' => array(
'name' => __( 'Flat Rate', 'woocommerce' ),
'description' => __( 'Set a fixed price to cover shipping costs.', 'woocommerce' ),
'settings' => array(
'cost' => array(
'type' => 'text',
'default_value' => __( 'Cost', 'woocommerce' ),
'description' => __( 'What would you like to charge for flat rate shipping?', 'woocommerce' ),
'required' => true,
),
),
),
'free_shipping' => array(
'name' => __( 'Free Shipping', 'woocommerce' ),
'description' => __( "Don't charge for shipping.", 'woocommerce' ),
),
);
return $shipping_methods;
}
/**
* Render the available shipping methods for a given country code.
*
* @param string $country_code Country code.
* @param string $currency_code Currency code.
* @param string $input_prefix Input prefix.
*
* @deprecated 4.6.0
*/
protected function shipping_method_selection_form( $country_code, $currency_code, $input_prefix ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$selected = 'flat_rate';
$shipping_methods = $this->get_wizard_shipping_methods( $country_code, $currency_code );
?>
<div class="wc-wizard-shipping-method-select">
<div class="wc-wizard-shipping-method-dropdown">
<select
id="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>"
name="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>"
class="method wc-enhanced-select"
data-plugins="<?php echo wc_esc_json( wp_json_encode( $this->get_wcs_requisite_plugins() ) ); ?>"
>
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<option value="<?php echo esc_attr( $method_id ); ?>" <?php selected( $selected, $method_id ); ?>><?php echo esc_html( $method['name'] ); ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="shipping-method-descriptions">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>">
<?php echo esc_html( $method['description'] ); ?>
</p>
<?php endforeach; ?>
</div>
</div>
<div class="shipping-method-settings">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<?php
if ( empty( $method['settings'] ) ) {
continue;
}
?>
<div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>">
<?php foreach ( $method['settings'] as $setting_id => $setting ) : ?>
<?php $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?>
<input
type="<?php echo esc_attr( $setting['type'] ); ?>"
placeholder="<?php echo esc_attr( $setting['default_value'] ); ?>"
id="<?php echo esc_attr( $method_setting_id ); ?>"
name="<?php echo esc_attr( $method_setting_id ); ?>"
class="<?php echo esc_attr( $setting['required'] ? 'shipping-method-required-field' : '' ); ?>"
<?php echo ( $method_id === $selected && $setting['required'] ) ? 'required' : ''; ?>
/>
<p class="description">
<?php echo esc_html( $setting['description'] ); ?>
</p>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
<?php
}
/**
* Render a product weight unit dropdown.
*
* @deprecated 4.6.0
* @return string
*/
protected function get_product_weight_selection() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$weight_unit = get_option( 'woocommerce_weight_unit' );
ob_start();
?>
<span class="wc-setup-shipping-unit">
<select id="weight_unit" name="weight_unit" class="wc-enhanced-select">
<option value="kg" <?php selected( $weight_unit, 'kg' ); ?>><?php esc_html_e( 'Kilograms', 'woocommerce' ); ?></option>
<option value="g" <?php selected( $weight_unit, 'g' ); ?>><?php esc_html_e( 'Grams', 'woocommerce' ); ?></option>
<option value="lbs" <?php selected( $weight_unit, 'lbs' ); ?>><?php esc_html_e( 'Pounds', 'woocommerce' ); ?></option>
<option value="oz" <?php selected( $weight_unit, 'oz' ); ?>><?php esc_html_e( 'Ounces', 'woocommerce' ); ?></option>
</select>
</span>
<?php
return ob_get_clean();
}
/**
* Render a product dimension unit dropdown.
*
* @deprecated 4.6.0
* @return string
*/
protected function get_product_dimension_selection() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$dimension_unit = get_option( 'woocommerce_dimension_unit' );
ob_start();
?>
<span class="wc-setup-shipping-unit">
<select id="dimension_unit" name="dimension_unit" class="wc-enhanced-select">
<option value="m" <?php selected( $dimension_unit, 'm' ); ?>><?php esc_html_e( 'Meters', 'woocommerce' ); ?></option>
<option value="cm" <?php selected( $dimension_unit, 'cm' ); ?>><?php esc_html_e( 'Centimeters', 'woocommerce' ); ?></option>
<option value="mm" <?php selected( $dimension_unit, 'mm' ); ?>><?php esc_html_e( 'Millimeters', 'woocommerce' ); ?></option>
<option value="in" <?php selected( $dimension_unit, 'in' ); ?>><?php esc_html_e( 'Inches', 'woocommerce' ); ?></option>
<option value="yd" <?php selected( $dimension_unit, 'yd' ); ?>><?php esc_html_e( 'Yards', 'woocommerce' ); ?></option>
</select>
</span>
<?php
return ob_get_clean();
}
/**
* Shipping.
*
* @deprecated 4.6.0
*/
public function wc_setup_shipping() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$country_code = WC()->countries->get_base_country();
$country_name = WC()->countries->countries[ $country_code ];
$prefixed_country_name = WC()->countries->estimated_for_prefix( $country_code ) . $country_name;
$currency_code = get_woocommerce_currency();
$existing_zones = WC_Shipping_Zones::get_zones();
$intro_text = '';
if ( empty( $existing_zones ) ) {
$intro_text = sprintf(
/* translators: %s: country name including the 'the' prefix if needed */
__( "We've created two Shipping Zones - for %s and for the rest of the world. Below you can set Flat Rate shipping costs for these Zones or offer Free Shipping.", 'woocommerce' ),
$prefixed_country_name
);
}
$is_wcs_labels_supported = $this->is_wcs_shipping_labels_supported_country( $country_code );
$is_shipstation_supported = $this->is_shipstation_supported_country( $country_code );
?>
<h1><?php esc_html_e( 'Shipping', 'woocommerce' ); ?></h1>
<?php if ( $intro_text ) : ?>
<p><?php echo wp_kses_post( $intro_text ); ?></p>
<?php endif; ?>
<form method="post">
<?php if ( $is_wcs_labels_supported || $is_shipstation_supported ) : ?>
<ul class="wc-setup-shipping-recommended">
<?php
if ( $is_wcs_labels_supported ) :
$this->display_recommended_item(
array(
'type' => 'woocommerce_services',
'title' => __( 'Did you know you can print shipping labels at home?', 'woocommerce' ),
'description' => __( 'Use WooCommerce Shipping (powered by WooCommerce Services & Jetpack) to save time at the post office by printing your shipping labels at home.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-woocommerce-services-icon.png',
'img_alt' => __( 'WooCommerce Services icon', 'woocommerce' ),
'plugins' => $this->get_wcs_requisite_plugins(),
)
);
elseif ( $is_shipstation_supported ) :
$this->display_recommended_item(
array(
'type' => 'shipstation',
'title' => __( 'Did you know you can print shipping labels at home?', 'woocommerce' ),
'description' => __( 'We recommend using ShipStation to save time at the post office by printing your shipping labels at home. Try ShipStation free for 30 days.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-shipstation-icon.png',
'img_alt' => __( 'ShipStation icon', 'woocommerce' ),
'plugins' => array(
array(
'name' => __( 'ShipStation', 'woocommerce' ),
'slug' => 'woocommerce-shipstation-integration',
),
),
)
);
endif;
?>
</ul>
<?php endif; ?>
<?php if ( empty( $existing_zones ) ) : ?>
<ul class="wc-wizard-services shipping">
<li class="wc-wizard-service-item">
<div class="wc-wizard-service-name">
<p><?php echo esc_html_e( 'Shipping Zone', 'woocommerce' ); ?></p>
</div>
<div class="wc-wizard-service-description">
<p><?php echo esc_html_e( 'Shipping Method', 'woocommerce' ); ?></p>
</div>
</li>
<li class="wc-wizard-service-item">
<div class="wc-wizard-service-name">
<p><?php echo esc_html( $country_name ); ?></p>
</div>
<div class="wc-wizard-service-description">
<?php $this->shipping_method_selection_form( $country_code, $currency_code, 'shipping_zones[domestic]' ); ?>
</div>
<div class="wc-wizard-service-enable">
<span class="wc-wizard-service-toggle">
<input id="shipping_zones[domestic][enabled]" type="checkbox" name="shipping_zones[domestic][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable" data-plugins="true" />
<label for="shipping_zones[domestic][enabled]">
</span>
</div>
</li>
<li class="wc-wizard-service-item">
<div class="wc-wizard-service-name">
<p><?php echo esc_html_e( 'Locations not covered by your other zones', 'woocommerce' ); ?></p>
</div>
<div class="wc-wizard-service-description">
<?php $this->shipping_method_selection_form( $country_code, $currency_code, 'shipping_zones[intl]' ); ?>
</div>
<div class="wc-wizard-service-enable">
<span class="wc-wizard-service-toggle">
<input id="shipping_zones[intl][enabled]" type="checkbox" name="shipping_zones[intl][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable" data-plugins="true" />
<label for="shipping_zones[intl][enabled]">
</span>
</div>
</li>
<li class="wc-wizard-service-info">
<p>
<?php
printf(
wp_kses(
/* translators: %1$s: live rates tooltip text, %2$s: shipping extensions URL */
__( 'If you\'d like to offer <span class="help_tip" data-tip="%1$s">live rates</span> from a specific carrier (e.g. UPS) you can find a variety of extensions available for WooCommerce <a href="%2$s" target="_blank">here</a>.', 'woocommerce' ),
array(
'span' => array(
'class' => array(),
'data-tip' => array(),
),
'a' => array(
'href' => array(),
'target' => array(),
),
)
),
esc_attr__( 'A live rate is the exact cost to ship an order, quoted directly from the shipping carrier.', 'woocommerce' ),
'https://woocommerce.com/product-category/woocommerce-extensions/shipping-methods/shipping-carriers/'
);
?>
</p>
</li>
</ul>
<?php endif; ?>
<div class="wc-setup-shipping-units">
<p>
<?php
echo wp_kses(
sprintf(
/* translators: %1$s: weight unit dropdown, %2$s: dimension unit dropdown */
esc_html__( 'We\'ll use %1$s for product weight and %2$s for product dimensions.', 'woocommerce' ),
$this->get_product_weight_selection(),
$this->get_product_dimension_selection()
),
array(
'span' => array(
'class' => array(),
),
'select' => array(
'id' => array(),
'name' => array(),
'class' => array(),
),
'option' => array(
'value' => array(),
'selected' => array(),
),
)
);
?>
</p>
</div>
<p class="wc-setup-actions step">
<?php $this->plugin_install_info(); ?>
<button class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'wc-setup' ); ?>
</p>
</form>
<?php
}
/**
* Save shipping options.
*
* @deprecated 4.6.0
*/
public function wc_setup_shipping_save() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
/**
* Is Stripe country supported
* https://stripe.com/global .
*
* @param string $country_code Country code.
*
* @deprecated 4.6.0
*/
protected function is_stripe_supported_country( $country_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$stripe_supported_countries = array(
'AU',
'AT',
'BE',
'CA',
'DK',
'FI',
'FR',
'DE',
'HK',
'IE',
'JP',
'LU',
'NL',
'NZ',
'NO',
'SG',
'ES',
'SE',
'CH',
'GB',
'US',
);
return in_array( $country_code, $stripe_supported_countries, true );
}
/**
* Is PayPal currency supported.
*
* @param string $currency Currency code.
* @return boolean
*
* @deprecated 4.6.0
*/
protected function is_paypal_supported_currency( $currency ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$supported_currencies = array(
'AUD',
'BRL',
'CAD',
'MXN',
'NZD',
'HKD',
'SGD',
'USD',
'EUR',
'JPY',
'TRY',
'NOK',
'CZK',
'DKK',
'HUF',
'ILS',
'MYR',
'PHP',
'PLN',
'SEK',
'CHF',
'TWD',
'THB',
'GBP',
'RMB',
'RUB',
'INR',
);
return in_array( $currency, $supported_currencies, true );
}
/**
* Is Klarna Checkout country supported.
*
* @param string $country_code Country code.
*
* @deprecated 4.6.0
*/
protected function is_klarna_checkout_supported_country( $country_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$supported_countries = array(
'SE', // Sweden.
'FI', // Finland.
'NO', // Norway.
'NL', // Netherlands.
);
return in_array( $country_code, $supported_countries, true );
}
/**
* Is Klarna Payments country supported.
*
* @param string $country_code Country code.
*
* @deprecated 4.6.0
*/
protected function is_klarna_payments_supported_country( $country_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$supported_countries = array(
'DK', // Denmark.
'DE', // Germany.
'AT', // Austria.
);
return in_array( $country_code, $supported_countries, true );
}
/**
* Is Square country supported
*
* @param string $country_code Country code.
*
* @deprecated 4.6.0
*/
protected function is_square_supported_country( $country_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$square_supported_countries = array(
'US',
'CA',
'JP',
'GB',
'AU',
);
return in_array( $country_code, $square_supported_countries, true );
}
/**
* Is eWAY Payments country supported
*
* @param string $country_code Country code.
*
* @deprecated 4.6.0
*/
protected function is_eway_payments_supported_country( $country_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$supported_countries = array(
'AU', // Australia.
'NZ', // New Zealand.
);
return in_array( $country_code, $supported_countries, true );
}
/**
* Is ShipStation country supported
*
* @param string $country_code Country code.
*
* @deprecated 4.6.0
*/
protected function is_shipstation_supported_country( $country_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$supported_countries = array(
'AU', // Australia.
'CA', // Canada.
'GB', // United Kingdom.
);
return in_array( $country_code, $supported_countries, true );
}
/**
* Is WooCommerce Services shipping label country supported
*
* @param string $country_code Country code.
*
* @deprecated 4.6.0
*/
protected function is_wcs_shipping_labels_supported_country( $country_code ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$supported_countries = array(
'US', // United States.
);
return in_array( $country_code, $supported_countries, true );
}
/**
* Helper method to retrieve the current user's email address.
*
* @deprecated 4.6.0
* @return string Email address
*/
protected function get_current_user_email() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$current_user = wp_get_current_user();
$user_email = $current_user->user_email;
return $user_email;
}
/**
* Array of all possible "in cart" gateways that can be offered.
*
* @deprecated 4.6.0
* @return array
*/
protected function get_wizard_available_in_cart_payment_gateways() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$user_email = $this->get_current_user_email();
$stripe_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Accept debit and credit cards in 135+ currencies, methods such as Alipay, and one-touch checkout with Apple Pay. <a href="%s" target="_blank">Learn more</a>.', 'woocommerce' ),
'https://woocommerce.com/products/stripe/'
) . '</p>';
$paypal_checkout_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Safe and secure payments using credit cards or your customer\'s PayPal account. <a href="%s" target="_blank">Learn more</a>.', 'woocommerce' ),
'https://woocommerce.com/products/woocommerce-gateway-paypal-checkout/'
) . '</p>';
$klarna_checkout_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Full checkout experience with pay now, pay later and slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
'https://woocommerce.com/products/klarna-checkout/'
) . '</p>';
$klarna_payments_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries. <a href="%s" target="_blank">Learn more about Klarna</a>.', 'woocommerce' ),
'https://woocommerce.com/products/klarna-payments/ '
) . '</p>';
$square_description = '<p>' . sprintf(
/* translators: %s: URL */
__( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place. <a href="%s" target="_blank">Learn more about Square</a>.', 'woocommerce' ),
'https://woocommerce.com/products/square/'
) . '</p>';
return array(
'stripe' => array(
'name' => __( 'WooCommerce Stripe Gateway', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/stripe.png',
'description' => $stripe_description,
'class' => 'checked stripe-logo',
'repo-slug' => 'woocommerce-gateway-stripe',
'settings' => array(
'create_account' => array(
'label' => __( 'Set up Stripe for me using this email:', 'woocommerce' ),
'type' => 'checkbox',
'value' => 'yes',
'default' => 'yes',
'placeholder' => '',
'required' => false,
'plugins' => $this->get_wcs_requisite_plugins(),
),
'email' => array(
'label' => __( 'Stripe email address:', 'woocommerce' ),
'type' => 'email',
'value' => $user_email,
'placeholder' => __( 'Stripe email address', 'woocommerce' ),
'required' => true,
),
),
),
'ppec_paypal' => array(
'name' => __( 'WooCommerce PayPal Checkout Gateway', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/paypal.png',
'description' => $paypal_checkout_description,
'enabled' => false,
'class' => 'checked paypal-logo',
'repo-slug' => 'woocommerce-gateway-paypal-express-checkout',
'settings' => array(
'reroute_requests' => array(
'label' => __( 'Set up PayPal for me using this email:', 'woocommerce' ),
'type' => 'checkbox',
'value' => 'yes',
'default' => 'yes',
'placeholder' => '',
'required' => false,
'plugins' => $this->get_wcs_requisite_plugins(),
),
'email' => array(
'label' => __( 'Direct payments to email address:', 'woocommerce' ),
'type' => 'email',
'value' => $user_email,
'placeholder' => __( 'Email address to receive payments', 'woocommerce' ),
'required' => true,
),
),
),
'paypal' => array(
'name' => __( 'PayPal Standard', 'woocommerce' ),
'description' => __( 'Accept payments via PayPal using account balance or credit card.', 'woocommerce' ),
'image' => '',
'settings' => array(
'email' => array(
'label' => __( 'PayPal email address:', 'woocommerce' ),
'type' => 'email',
'value' => $user_email,
'placeholder' => __( 'PayPal email address', 'woocommerce' ),
'required' => true,
),
),
),
'klarna_checkout' => array(
'name' => __( 'Klarna Checkout for WooCommerce', 'woocommerce' ),
'description' => $klarna_checkout_description,
'image' => WC()->plugin_url() . '/assets/images/klarna-black.png',
'enabled' => true,
'class' => 'klarna-logo',
'repo-slug' => 'klarna-checkout-for-woocommerce',
),
'klarna_payments' => array(
'name' => __( 'Klarna Payments for WooCommerce', 'woocommerce' ),
'description' => $klarna_payments_description,
'image' => WC()->plugin_url() . '/assets/images/klarna-black.png',
'enabled' => true,
'class' => 'klarna-logo',
'repo-slug' => 'klarna-payments-for-woocommerce',
),
'square' => array(
'name' => __( 'WooCommerce Square', 'woocommerce' ),
'description' => $square_description,
'image' => WC()->plugin_url() . '/assets/images/square-black.png',
'class' => 'square-logo',
'enabled' => false,
'repo-slug' => 'woocommerce-square',
),
'eway' => array(
'name' => __( 'WooCommerce eWAY Gateway', 'woocommerce' ),
'description' => __( 'The eWAY extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/eway-logo.jpg',
'enabled' => false,
'class' => 'eway-logo',
'repo-slug' => 'woocommerce-gateway-eway',
),
'payfast' => array(
'name' => __( 'WooCommerce PayFast Gateway', 'woocommerce' ),
'description' => __( 'The PayFast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africa’s most popular payment gateways. No setup fees or monthly subscription costs.', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/payfast.png',
'class' => 'payfast-logo',
'enabled' => false,
'repo-slug' => 'woocommerce-payfast-gateway',
'file' => 'gateway-payfast.php',
),
);
}
/**
* Simple array of "in cart" gateways to show in wizard.
*
* @deprecated 4.6.0
* @return array
*/
public function get_wizard_in_cart_payment_gateways() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$gateways = $this->get_wizard_available_in_cart_payment_gateways();
$country = WC()->countries->get_base_country();
$currency = get_woocommerce_currency();
$can_stripe = $this->is_stripe_supported_country( $country );
$can_eway = $this->is_eway_payments_supported_country( $country );
$can_payfast = ( 'ZA' === $country ); // South Africa.
$can_paypal = $this->is_paypal_supported_currency( $currency );
if ( ! current_user_can( 'install_plugins' ) ) {
return $can_paypal ? array( 'paypal' => $gateways['paypal'] ) : array();
}
$klarna_or_square = false;
if ( $this->is_klarna_checkout_supported_country( $country ) ) {
$klarna_or_square = 'klarna_checkout';
} elseif ( $this->is_klarna_payments_supported_country( $country ) ) {
$klarna_or_square = 'klarna_payments';
} elseif ( $this->is_square_supported_country( $country ) && get_option( 'woocommerce_sell_in_person' ) ) {
$klarna_or_square = 'square';
}
$offered_gateways = array();
if ( $can_stripe ) {
$gateways['stripe']['enabled'] = true;
$gateways['stripe']['featured'] = true;
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
} elseif ( $can_paypal ) {
$gateways['ppec_paypal']['enabled'] = true;
}
if ( $klarna_or_square ) {
if ( in_array( $klarna_or_square, array( 'klarna_checkout', 'klarna_payments' ), true ) ) {
$gateways[ $klarna_or_square ]['enabled'] = true;
$gateways[ $klarna_or_square ]['featured'] = false;
$offered_gateways += array(
$klarna_or_square => $gateways[ $klarna_or_square ],
);
} else {
$offered_gateways += array(
$klarna_or_square => $gateways[ $klarna_or_square ],
);
}
}
if ( $can_paypal ) {
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
}
if ( $can_eway ) {
$offered_gateways += array( 'eway' => $gateways['eway'] );
}
if ( $can_payfast ) {
$offered_gateways += array( 'payfast' => $gateways['payfast'] );
}
return $offered_gateways;
}
/**
* Simple array of "manual" gateways to show in wizard.
*
* @deprecated 4.6.0
* @return array
*/
public function get_wizard_manual_payment_gateways() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$gateways = array(
'cheque' => array(
'name' => _x( 'Check payments', 'Check payment method', 'woocommerce' ),
'description' => __( 'A simple offline gateway that lets you accept a check as method of payment.', 'woocommerce' ),
'image' => '',
'class' => '',
),
'bacs' => array(
'name' => __( 'Bank transfer (BACS) payments', 'woocommerce' ),
'description' => __( 'A simple offline gateway that lets you accept BACS payment.', 'woocommerce' ),
'image' => '',
'class' => '',
),
'cod' => array(
'name' => __( 'Cash on delivery', 'woocommerce' ),
'description' => __( 'A simple offline gateway that lets you accept cash on delivery.', 'woocommerce' ),
'image' => '',
'class' => '',
),
);
return $gateways;
}
/**
* Display service item in list.
*
* @param int $item_id Item ID.
* @param array $item_info Item info array.
*
* @deprecated 4.6.0
*/
public function display_service_item( $item_id, $item_info ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$item_class = 'wc-wizard-service-item';
if ( isset( $item_info['class'] ) ) {
$item_class .= ' ' . $item_info['class'];
}
$previously_saved_settings = get_option( 'woocommerce_' . $item_id . '_settings' );
// Show the user-saved state if it was previously saved.
// Otherwise, rely on the item info.
if ( is_array( $previously_saved_settings ) ) {
$should_enable_toggle = ( isset( $previously_saved_settings['enabled'] ) && 'yes' === $previously_saved_settings['enabled'] ) ? true : ( isset( $item_info['enabled'] ) && $item_info['enabled'] );
} else {
$should_enable_toggle = isset( $item_info['enabled'] ) && $item_info['enabled'];
}
$plugins = null;
if ( isset( $item_info['repo-slug'] ) ) {
$plugin = array(
'slug' => $item_info['repo-slug'],
'name' => $item_info['name'],
);
$plugins = array( $plugin );
}
?>
<li class="<?php echo esc_attr( $item_class ); ?>">
<div class="wc-wizard-service-name">
<?php if ( ! empty( $item_info['image'] ) ) : ?>
<img src="<?php echo esc_attr( $item_info['image'] ); ?>" alt="<?php echo esc_attr( $item_info['name'] ); ?>" />
<?php else : ?>
<p><?php echo esc_html( $item_info['name'] ); ?></p>
<?php endif; ?>
</div>
<div class="wc-wizard-service-enable">
<span class="wc-wizard-service-toggle <?php echo esc_attr( $should_enable_toggle ? '' : 'disabled' ); ?>" tabindex="0">
<input
id="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>"
type="checkbox"
name="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>-enabled"
value="yes" <?php checked( $should_enable_toggle ); ?>
data-plugins="<?php echo wc_esc_json( wp_json_encode( $plugins ) ); ?>"
/>
<label for="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>">
</span>
</div>
<div class="wc-wizard-service-description">
<?php echo wp_kses_post( wpautop( $item_info['description'] ) ); ?>
<?php if ( ! empty( $item_info['settings'] ) ) : ?>
<div class="wc-wizard-service-settings <?php echo $should_enable_toggle ? '' : 'hide'; ?>">
<?php foreach ( $item_info['settings'] as $setting_id => $setting ) : ?>
<?php
$is_checkbox = 'checkbox' === $setting['type'];
if ( $is_checkbox ) {
$checked = false;
if ( isset( $previously_saved_settings[ $setting_id ] ) ) {
$checked = 'yes' === $previously_saved_settings[ $setting_id ];
} elseif ( false === $previously_saved_settings && isset( $setting['default'] ) ) {
$checked = 'yes' === $setting['default'];
}
}
if ( 'email' === $setting['type'] ) {
$value = empty( $previously_saved_settings[ $setting_id ] )
? $setting['value']
: $previously_saved_settings[ $setting_id ];
}
?>
<?php $input_id = $item_id . '_' . $setting_id; ?>
<div class="<?php echo esc_attr( 'wc-wizard-service-setting-' . $input_id ); ?>">
<label
for="<?php echo esc_attr( $input_id ); ?>"
class="<?php echo esc_attr( $input_id ); ?>"
>
<?php echo esc_html( $setting['label'] ); ?>
</label>
<input
type="<?php echo esc_attr( $setting['type'] ); ?>"
id="<?php echo esc_attr( $input_id ); ?>"
class="<?php echo esc_attr( 'payment-' . $setting['type'] . '-input' ); ?>"
name="<?php echo esc_attr( $input_id ); ?>"
value="<?php echo esc_attr( isset( $value ) ? $value : $setting['value'] ); ?>"
placeholder="<?php echo esc_attr( $setting['placeholder'] ); ?>"
<?php echo ( $setting['required'] ) ? 'required' : ''; ?>
<?php echo $is_checkbox ? checked( isset( $checked ) && $checked, true, false ) : ''; ?>
data-plugins="<?php echo wc_esc_json( wp_json_encode( isset( $setting['plugins'] ) ? $setting['plugins'] : null ) ); ?>"
/>
<?php if ( ! empty( $setting['description'] ) ) : ?>
<span class="wc-wizard-service-settings-description"><?php echo esc_html( $setting['description'] ); ?></span>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</li>
<?php
}
/**
* Is it a featured service?
*
* @param array $service Service info array.
*
* @deprecated 4.6.0
* @return boolean
*/
public function is_featured_service( $service ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
return ! empty( $service['featured'] );
}
/**
* Is this a non featured service?
*
* @param array $service Service info array.
*
* @deprecated 4.6.0
* @return boolean
*/
public function is_not_featured_service( $service ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
return ! $this->is_featured_service( $service );
}
/**
* Payment Step.
*
* @deprecated 4.6.0
*/
public function wc_setup_payment() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$featured_gateways = array_filter( $this->get_wizard_in_cart_payment_gateways(), array( $this, 'is_featured_service' ) );
$in_cart_gateways = array_filter( $this->get_wizard_in_cart_payment_gateways(), array( $this, 'is_not_featured_service' ) );
$manual_gateways = $this->get_wizard_manual_payment_gateways();
?>
<h1><?php esc_html_e( 'Payment', 'woocommerce' ); ?></h1>
<form method="post" class="wc-wizard-payment-gateway-form">
<p>
<?php
printf(
wp_kses(
/* translators: %s: Link */
__( 'WooCommerce can accept both online and offline payments. <a href="%s" target="_blank">Additional payment methods</a> can be installed later.', 'woocommerce' ),
array(
'a' => array(
'href' => array(),
'target' => array(),
),
)
),
esc_url( admin_url( 'admin.php?page=wc-addons§ion=payment-gateways' ) )
);
?>
</p>
<?php if ( $featured_gateways ) : ?>
<ul class="wc-wizard-services featured">
<?php
foreach ( $featured_gateways as $gateway_id => $gateway ) {
$this->display_service_item( $gateway_id, $gateway );
}
?>
</ul>
<?php endif; ?>
<?php if ( $in_cart_gateways ) : ?>
<ul class="wc-wizard-services in-cart">
<?php
foreach ( $in_cart_gateways as $gateway_id => $gateway ) {
$this->display_service_item( $gateway_id, $gateway );
}
?>
</ul>
<?php endif; ?>
<ul class="wc-wizard-services manual">
<li class="wc-wizard-services-list-toggle closed">
<div class="wc-wizard-service-name">
<?php esc_html_e( 'Offline Payments', 'woocommerce' ); ?>
</div>
<div class="wc-wizard-service-description">
<?php esc_html_e( 'Collect payments from customers offline.', 'woocommerce' ); ?>
</div>
<div class="wc-wizard-service-enable" tabindex="0">
<input class="wc-wizard-service-list-toggle" id="wc-wizard-service-list-toggle" type="checkbox">
<label for="wc-wizard-service-list-toggle"></label>
</div>
</li>
<?php
foreach ( $manual_gateways as $gateway_id => $gateway ) {
$this->display_service_item( $gateway_id, $gateway );
}
?>
</ul>
<p class="wc-setup-actions step">
<?php $this->plugin_install_info(); ?>
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'wc-setup' ); ?>
</p>
</form>
<?php
}
/**
* Payment Step save.
*
* @deprecated 4.6.0
*/
public function wc_setup_payment_save() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
protected function display_recommended_item( $item_info ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$type = $item_info['type'];
$title = $item_info['title'];
$description = $item_info['description'];
$img_url = $item_info['img_url'];
$img_alt = $item_info['img_alt'];
?>
<li class="recommended-item checkbox">
<input
id="<?php echo esc_attr( 'wc_recommended_' . $type ); ?>"
type="checkbox"
name="<?php echo esc_attr( 'setup_' . $type ); ?>"
value="yes"
checked
data-plugins="<?php echo wc_esc_json( wp_json_encode( isset( $item_info['plugins'] ) ? $item_info['plugins'] : null ) ); ?>"
/>
<label for="<?php echo esc_attr( 'wc_recommended_' . $type ); ?>">
<img
src="<?php echo esc_url( $img_url ); ?>"
class="<?php echo esc_attr( 'recommended-item-icon-' . $type ); ?> recommended-item-icon"
alt="<?php echo esc_attr( $img_alt ); ?>" />
<div class="recommended-item-description-container">
<h3><?php echo esc_html( $title ); ?></h3>
<p><?php echo wp_kses( $description, array(
'a' => array(
'href' => array(),
'target' => array(),
'rel' => array(),
),
'em' => array(),
) ); ?></p>
</div>
</label>
</li>
<?php
}
/**
* Recommended step
*
* @deprecated 4.6.0
*/
public function wc_setup_recommended() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
?>
<h1><?php esc_html_e( 'Recommended for All WooCommerce Stores', 'woocommerce' ); ?></h1>
<p>
<?php esc_html_e( 'Enhance your store with these recommended free features.', 'woocommerce' ); ?>
</p>
<form method="post">
<ul class="recommended-step">
<?php
if ( $this->should_show_theme() ) :
$theme = wp_get_theme();
$theme_name = $theme['Name'];
$this->display_recommended_item( array(
'type' => 'storefront_theme',
'title' => __( 'Storefront Theme', 'woocommerce' ),
'description' => sprintf( __(
'Design your store with deep WooCommerce integration. If toggled on, we’ll install <a href="https://woocommerce.com/storefront/" target="_blank" rel="noopener noreferrer">Storefront</a>, and your current theme <em>%s</em> will be deactivated.', 'woocommerce' ),
$theme_name
),
'img_url' => WC()->plugin_url() . '/assets/images/obw-storefront-icon.svg',
'img_alt' => __( 'Storefront icon', 'woocommerce' ),
) );
endif;
if ( $this->should_show_automated_tax() ) :
$this->display_recommended_item( array(
'type' => 'automated_taxes',
'title' => __( 'Automated Taxes', 'woocommerce' ),
'description' => __( 'Save time and errors with automated tax calculation and collection at checkout. Powered by WooCommerce Services and Jetpack.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-taxes-icon.svg',
'img_alt' => __( 'automated taxes icon', 'woocommerce' ),
'plugins' => $this->get_wcs_requisite_plugins(),
) );
endif;
if ( $this->should_show_wc_admin() ) :
$this->display_recommended_item( array(
'type' => 'wc_admin',
'title' => __( 'WooCommerce Admin', 'woocommerce' ),
'description' => __( 'Manage your store\'s reports and monitor key metrics with a new and improved interface and dashboard.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-woocommerce-admin-icon.svg',
'img_alt' => __( 'WooCommerce Admin icon', 'woocommerce' ),
'plugins' => array( array( 'name' => __( 'WooCommerce Admin', 'woocommerce' ), 'slug' => 'woocommerce-admin' ) ),
) );
endif;
if ( $this->should_show_mailchimp() ) :
$this->display_recommended_item( array(
'type' => 'mailchimp',
'title' => __( 'Mailchimp', 'woocommerce' ),
'description' => __( 'Join the 16 million customers who use Mailchimp. Sync list and store data to send automated emails, and targeted campaigns.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-mailchimp-icon.svg',
'img_alt' => __( 'Mailchimp icon', 'woocommerce' ),
'plugins' => array( array( 'name' => __( 'Mailchimp for WooCommerce', 'woocommerce' ), 'slug' => 'mailchimp-for-woocommerce' ) ),
) );
endif;
if ( $this->should_show_facebook() ) :
$this->display_recommended_item( array(
'type' => 'facebook',
'title' => __( 'Facebook', 'woocommerce' ),
'description' => __( 'Enjoy all Facebook products combined in one extension: pixel tracking, catalog sync, messenger chat, shop functionality and Instagram shopping (coming soon)!', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-facebook-icon.svg',
'img_alt' => __( 'Facebook icon', 'woocommerce' ),
'plugins' => array( array( 'name' => __( 'Facebook for WooCommerce', 'woocommerce' ), 'slug' => 'facebook-for-woocommerce' ) ),
) );
endif;
?>
</ul>
<p class="wc-setup-actions step">
<?php $this->plugin_install_info(); ?>
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'wc-setup' ); ?>
</p>
</form>
<?php
}
/**
* Recommended step save.
*
* @deprecated 4.6.0
*/
public function wc_setup_recommended_save() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
/**
* Go to the next step if Jetpack was connected.
*/
protected function wc_setup_activate_actions() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
if (
isset( $_GET['from'] ) &&
'wpcom' === $_GET['from'] &&
class_exists( 'Jetpack' ) &&
Jetpack::is_active()
) {
wp_redirect( esc_url_raw( remove_query_arg( 'from', $this->get_next_step_link() ) ) );
exit;
}
}
/**
*
* @deprecated 4.6.0
*/
protected function wc_setup_activate_get_feature_list() {
$features = array();
$stripe_settings = get_option( 'woocommerce_stripe_settings', false );
$stripe_enabled = is_array( $stripe_settings )
&& isset( $stripe_settings['create_account'] ) && 'yes' === $stripe_settings['create_account']
&& isset( $stripe_settings['enabled'] ) && 'yes' === $stripe_settings['enabled'];
$ppec_settings = get_option( 'woocommerce_ppec_paypal_settings', false );
$ppec_enabled = is_array( $ppec_settings )
&& isset( $ppec_settings['reroute_requests'] ) && 'yes' === $ppec_settings['reroute_requests']
&& isset( $ppec_settings['enabled'] ) && 'yes' === $ppec_settings['enabled'];
$features['payment'] = $stripe_enabled || $ppec_enabled;
$features['taxes'] = (bool) get_option( 'woocommerce_setup_automated_taxes', false );
$features['labels'] = (bool) get_option( 'woocommerce_setup_shipping_labels', false );
return $features;
}
/**
*
* @deprecated 4.6.0
*/
protected function wc_setup_activate_get_feature_list_str() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$features = $this->wc_setup_activate_get_feature_list();
if ( $features['payment'] && $features['taxes'] && $features['labels'] ) {
return __( 'payment setup, automated taxes and discounted shipping labels', 'woocommerce' );
} else if ( $features['payment'] && $features['taxes'] ) {
return __( 'payment setup and automated taxes', 'woocommerce' );
} else if ( $features['payment'] && $features['labels'] ) {
return __( 'payment setup and discounted shipping labels', 'woocommerce' );
} else if ( $features['payment'] ) {
return __( 'payment setup', 'woocommerce' );
} else if ( $features['taxes'] && $features['labels'] ) {
return __( 'automated taxes and discounted shipping labels', 'woocommerce' );
} else if ( $features['taxes'] ) {
return __( 'automated taxes', 'woocommerce' );
} else if ( $features['labels'] ) {
return __( 'discounted shipping labels', 'woocommerce' );
}
return false;
}
/**
* Activate step.
*
* @deprecated 4.6.0
*/
public function wc_setup_activate() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$this->wc_setup_activate_actions();
$jetpack_connected = class_exists( 'Jetpack' ) && Jetpack::is_active();
$has_jetpack_error = false;
if ( isset( $_GET['activate_error'] ) ) {
$has_jetpack_error = true;
$title = __( "Sorry, we couldn't connect your store to Jetpack", 'woocommerce' );
$error_message = $this->get_activate_error_message( sanitize_text_field( wp_unslash( $_GET['activate_error'] ) ) );
$description = $error_message;
} else {
$feature_list = $this->wc_setup_activate_get_feature_list_str();
$description = false;
if ( $feature_list ) {
if ( ! $jetpack_connected ) {
/* translators: %s: list of features, potentially comma separated */
$description_base = __( 'Your store is almost ready! To activate services like %s, just connect with Jetpack.', 'woocommerce' );
} else {
$description_base = __( 'Thanks for using Jetpack! Your store is almost ready: to activate services like %s, just connect your store.', 'woocommerce' );
}
$description = sprintf( $description_base, $feature_list );
}
if ( ! $jetpack_connected ) {
$title = $feature_list ?
__( 'Connect your store to Jetpack', 'woocommerce' ) :
__( 'Connect your store to Jetpack to enable extra features', 'woocommerce' );
$button_text = __( 'Continue with Jetpack', 'woocommerce' );
} elseif ( $feature_list ) {
$title = __( 'Connect your store to activate WooCommerce Services', 'woocommerce' );
$button_text = __( 'Continue with WooCommerce Services', 'woocommerce' );
} else {
wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
exit;
}
}
?>
<h1><?php echo esc_html( $title ); ?></h1>
<p><?php echo esc_html( $description ); ?></p>
<?php if ( $jetpack_connected ) : ?>
<div class="activate-splash">
<img
class="jetpack-logo"
src="<?php echo esc_url( WC()->plugin_url() . '/assets/images/jetpack_horizontal_logo.png' ); ?>"
alt="<?php esc_attr_e( 'Jetpack logo', 'woocommerce' ); ?>"
/>
<img
class="wcs-notice"
src="<?php echo esc_url( WC()->plugin_url() . '/assets/images/wcs-notice.png' ); ?>"
/>
</div>
<?php else : ?>
<img
class="jetpack-logo"
src="<?php echo esc_url( WC()->plugin_url() . '/assets/images/jetpack_vertical_logo.png' ); ?>"
alt="<?php esc_attr_e( 'Jetpack logo', 'woocommerce' ); ?>"
/>
<?php endif; ?>
<?php if ( $has_jetpack_error ) : ?>
<p class="wc-setup-actions step">
<a
href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
class="button-primary button button-large"
>
<?php esc_html_e( 'Finish setting up your store', 'woocommerce' ); ?>
</a>
</p>
<?php else : ?>
<p class="jetpack-terms">
<?php
printf(
wp_kses_post( __( 'By connecting your site you agree to our fascinating <a href="%1$s" target="_blank">Terms of Service</a> and to <a href="%2$s" target="_blank">share details</a> with WordPress.com', 'woocommerce' ) ),
'https://wordpress.com/tos',
'https://jetpack.com/support/what-data-does-jetpack-sync'
);
?>
</p>
<form method="post" class="activate-jetpack">
<p class="wc-setup-actions step">
<button type="submit" class="button-primary button button-large" value="<?php echo esc_attr( $button_text ); ?>"><?php echo esc_html( $button_text ); ?></button>
</p>
<input type="hidden" name="save_step" value="activate" />
<?php wp_nonce_field( 'wc-setup' ); ?>
</form>
<?php if ( ! $jetpack_connected ) : ?>
<h3 class="jetpack-reasons">
<?php
echo esc_html( $description ?
__( "Bonus reasons you'll love Jetpack", 'woocommerce' ) :
__( "Reasons you'll love Jetpack", 'woocommerce' )
);
?>
</h3>
<ul class="wc-wizard-features">
<li class="wc-wizard-feature-item">
<p class="wc-wizard-feature-name">
<strong><?php esc_html_e( 'Better security', 'woocommerce' ); ?></strong>
</p>
<p class="wc-wizard-feature-description">
<?php esc_html_e( 'Protect your store from unauthorized access.', 'woocommerce' ); ?>
</p>
</li>
<li class="wc-wizard-feature-item">
<p class="wc-wizard-feature-name">
<strong><?php esc_html_e( 'Store stats', 'woocommerce' ); ?></strong>
</p>
<p class="wc-wizard-feature-description">
<?php esc_html_e( 'Get insights on how your store is doing, including total sales, top products, and more.', 'woocommerce' ); ?>
</p>
</li>
<li class="wc-wizard-feature-item">
<p class="wc-wizard-feature-name">
<strong><?php esc_html_e( 'Store monitoring', 'woocommerce' ); ?></strong>
</p>
<p class="wc-wizard-feature-description">
<?php esc_html_e( 'Get an alert if your store is down for even a few minutes.', 'woocommerce' ); ?>
</p>
</li>
<li class="wc-wizard-feature-item">
<p class="wc-wizard-feature-name">
<strong><?php esc_html_e( 'Product promotion', 'woocommerce' ); ?></strong>
</p>
<p class="wc-wizard-feature-description">
<?php esc_html_e( "Share new items on social media the moment they're live in your store.", 'woocommerce' ); ?>
</p>
</li>
</ul>
<?php endif; ?>
<?php endif; ?>
<?php
}
/**
*
* @deprecated 4.6.0
*/
protected function get_all_activate_errors() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
return array(
'default' => __( "Sorry! We tried, but we couldn't connect Jetpack just now 😭. Please go to the Plugins tab to connect Jetpack, so that you can finish setting up your store.", 'woocommerce' ),
'jetpack_cant_be_installed' => __( "Sorry! We tried, but we couldn't install Jetpack for you 😭. Please go to the Plugins tab to install it, and finish setting up your store.", 'woocommerce' ),
'register_http_request_failed' => __( "Sorry! We couldn't contact Jetpack just now 😭. Please make sure that your site is visible over the internet, and that it accepts incoming and outgoing requests via curl. You can also try to connect to Jetpack again, and if you run into any more issues, please contact support.", 'woocommerce' ),
'siteurl_private_ip_dev' => __( "Your site might be on a private network. Jetpack can only connect to public sites. Please make sure your site is visible over the internet, and then try connecting again 🙏." , 'woocommerce' ),
);
}
/**
*
* @deprecated 4.6.0
*/
protected function get_activate_error_message( $code = '' ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$errors = $this->get_all_activate_errors();
return array_key_exists( $code, $errors ) ? $errors[ $code ] : $errors['default'];
}
/**
* Activate step save.
*
* Install, activate, and launch connection flow for Jetpack.
*
* @deprecated 4.6.0
*/
public function wc_setup_activate_save() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
}
/**
* Final step.
*
* @deprecated 4.6.0
*/
public function wc_setup_ready() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
// We've made it! Don't prompt the user to run the wizard again.
WC_Admin_Notices::remove_notice( 'install', true );
$user_email = $this->get_current_user_email();
$docs_url = 'https://docs.woocommerce.com/documentation/plugins/woocommerce/getting-started/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin';
$help_text = sprintf(
/* translators: %1$s: link to docs */
__( 'Visit WooCommerce.com to learn more about <a href="%1$s" target="_blank">getting started</a>.', 'woocommerce' ),
$docs_url
);
?>
<h1><?php esc_html_e( "You're ready to start selling!", 'woocommerce' ); ?></h1>
<div class="woocommerce-message woocommerce-newsletter">
<p><?php esc_html_e( "We're here for you — get tips, product updates, and inspiration straight to your mailbox.", 'woocommerce' ); ?></p>
<form action="//woocommerce.us8.list-manage.com/subscribe/post?u=2c1434dc56f9506bf3c3ecd21&id=13860df971&SIGNUPPAGE=plugin" method="post" target="_blank" novalidate>
<div class="newsletter-form-container">
<input
class="newsletter-form-email"
type="email"
value="<?php echo esc_attr( $user_email ); ?>"
name="EMAIL"
placeholder="<?php esc_attr_e( 'Email address', 'woocommerce' ); ?>"
required
>
<p class="wc-setup-actions step newsletter-form-button-container">
<button
type="submit"
value="<?php esc_attr_e( 'Yes please!', 'woocommerce' ); ?>"
name="subscribe"
id="mc-embedded-subscribe"
class="button-primary button newsletter-form-button"
><?php esc_html_e( 'Yes please!', 'woocommerce' ); ?></button>
</p>
</div>
</form>
</div>
<ul class="wc-wizard-next-steps">
<li class="wc-wizard-next-step-item">
<div class="wc-wizard-next-step-description">
<p class="next-step-heading"><?php esc_html_e( 'Next step', 'woocommerce' ); ?></p>
<h3 class="next-step-description"><?php esc_html_e( 'Create some products', 'woocommerce' ); ?></h3>
<p class="next-step-extra-info"><?php esc_html_e( "You're ready to add products to your store.", 'woocommerce' ); ?></p>
</div>
<div class="wc-wizard-next-step-action">
<p class="wc-setup-actions step">
<a class="button button-primary button-large" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=product&tutorial=true' ) ); ?>">
<?php esc_html_e( 'Create a product', 'woocommerce' ); ?>
</a>
</p>
</div>
</li>
<li class="wc-wizard-next-step-item">
<div class="wc-wizard-next-step-description">
<p class="next-step-heading"><?php esc_html_e( 'Have an existing store?', 'woocommerce' ); ?></p>
<h3 class="next-step-description"><?php esc_html_e( 'Import products', 'woocommerce' ); ?></h3>
<p class="next-step-extra-info"><?php esc_html_e( 'Transfer existing products to your new store — just import a CSV file.', 'woocommerce' ); ?></p>
</div>
<div class="wc-wizard-next-step-action">
<p class="wc-setup-actions step">
<a class="button button-large" href="<?php echo esc_url( admin_url( 'edit.php?post_type=product&page=product_importer' ) ); ?>">
<?php esc_html_e( 'Import products', 'woocommerce' ); ?>
</a>
</p>
</div>
</li>
<li class="wc-wizard-additional-steps">
<div class="wc-wizard-next-step-description">
<p class="next-step-heading"><?php esc_html_e( 'You can also:', 'woocommerce' ); ?></p>
</div>
<div class="wc-wizard-next-step-action">
<p class="wc-setup-actions step">
<a class="button button-large" href="<?php echo esc_url( admin_url() ); ?>">
<?php esc_html_e( 'Visit Dashboard', 'woocommerce' ); ?>
</a>
<a class="button button-large" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings' ) ); ?>">
<?php esc_html_e( 'Review Settings', 'woocommerce' ); ?>
</a>
<a class="button button-large" href="<?php echo esc_url( add_query_arg( array( 'autofocus' => array( 'panel' => 'woocommerce' ), 'url' => wc_get_page_permalink( 'shop' ) ), admin_url( 'customize.php' ) ) ); ?>">
<?php esc_html_e( 'View & Customize', 'woocommerce' ); ?>
</a>
</p>
</div>
</li>
</ul>
<p class="next-steps-help-text"><?php echo wp_kses_post( $help_text ); ?></p>
<?php
}
}