WooCommerce Customizer - Version 2.5.0

Version Description

  • Feature - Added sales badge text customization
Download this release

Release Info

Developer SkyVerge
Plugin Icon WooCommerce Customizer
Version 2.5.0
Comparing to
See all releases

Code changes from version 2.4.0 to 2.5.0

i18n/languages/woocommerce-customizer.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Customizer 2.4.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/skyverge/woocommerce-customizer/issues\n"
8
  "POT-Creation-Date: 2014-09-05 23:18:53+00:00\n"
@@ -30,12 +30,12 @@ msgid "Checkout"
30
  msgstr ""
31
 
32
  #: includes/class-wc-customizer-settings.php:65
33
- #: includes/class-wc-customizer-settings.php:307
34
  msgid "Misc"
35
  msgstr ""
36
 
37
  #: includes/class-wc-customizer-settings.php:148
38
- #: includes/class-wc-customizer-settings.php:259
39
  msgid "Add to Cart Button Text"
40
  msgstr ""
41
 
@@ -74,170 +74,201 @@ msgid ""
74
  msgstr ""
75
 
76
  #: includes/class-wc-customizer-settings.php:183
77
- msgid "Layout"
 
78
  msgstr ""
79
 
80
  #: includes/class-wc-customizer-settings.php:189
81
- msgid "Products displayed per page"
 
82
  msgstr ""
83
 
84
  #: includes/class-wc-customizer-settings.php:190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  msgid "Changes the number of products displayed per page"
86
  msgstr ""
87
 
88
- #: includes/class-wc-customizer-settings.php:196
89
  msgid "Product columns displayed per page"
90
  msgstr ""
91
 
92
- #: includes/class-wc-customizer-settings.php:197
93
  msgid "Changes the number of columns displayed per page"
94
  msgstr ""
95
 
96
- #: includes/class-wc-customizer-settings.php:203
97
  msgid "Product thumbnail columns displayed"
98
  msgstr ""
99
 
100
- #: includes/class-wc-customizer-settings.php:204
101
  msgid "Changes the number of product thumbnail columns displayed"
102
  msgstr ""
103
 
104
- #: includes/class-wc-customizer-settings.php:217
105
  msgid "Tab Titles"
106
  msgstr ""
107
 
108
- #: includes/class-wc-customizer-settings.php:223
109
- #: includes/class-wc-customizer-settings.php:244
110
  msgid "Product Description"
111
  msgstr ""
112
 
113
- #: includes/class-wc-customizer-settings.php:224
114
  msgid "Changes the Production Description tab title"
115
  msgstr ""
116
 
117
- #: includes/class-wc-customizer-settings.php:230
118
- #: includes/class-wc-customizer-settings.php:251
119
  msgid "Additional Information"
120
  msgstr ""
121
 
122
- #: includes/class-wc-customizer-settings.php:231
123
  msgid "Changes the Additional Information tab title"
124
  msgstr ""
125
 
126
- #: includes/class-wc-customizer-settings.php:238
127
  msgid "Tab Content Headings"
128
  msgstr ""
129
 
130
- #: includes/class-wc-customizer-settings.php:245
131
  msgid "Changes the Product Description tab heading"
132
  msgstr ""
133
 
134
- #: includes/class-wc-customizer-settings.php:252
135
  msgid "Changes the Additional Information tab heading"
136
  msgstr ""
137
 
138
- #: includes/class-wc-customizer-settings.php:265
139
  msgid "All Product Types"
140
  msgstr ""
141
 
142
- #: includes/class-wc-customizer-settings.php:266
143
  msgid ""
144
  "Changes the Add to Cart button text on the single product page for all "
145
  "product type"
146
  msgstr ""
147
 
148
- #: includes/class-wc-customizer-settings.php:278
 
 
 
 
149
  msgid "Messages"
150
  msgstr ""
151
 
152
- #: includes/class-wc-customizer-settings.php:284
153
  msgid "Must be logged in text"
154
  msgstr ""
155
 
156
- #: includes/class-wc-customizer-settings.php:285
157
  msgid "Changes the message displayed when a customer must be logged in to checkout"
158
  msgstr ""
159
 
160
- #: includes/class-wc-customizer-settings.php:291
161
  msgid "Coupon text"
162
  msgstr ""
163
 
164
- #: includes/class-wc-customizer-settings.php:292
165
  msgid "Changes the message displayed if the coupon form is enabled on checkout"
166
  msgstr ""
167
 
168
- #: includes/class-wc-customizer-settings.php:299
169
  msgid "Login text"
170
  msgstr ""
171
 
172
- #: includes/class-wc-customizer-settings.php:300
173
  msgid "Changes the message displayed if customers can login at checkout"
174
  msgstr ""
175
 
176
- #: includes/class-wc-customizer-settings.php:313
177
  msgid "Create Account checkbox default"
178
  msgstr ""
179
 
180
- #: includes/class-wc-customizer-settings.php:314
181
  msgid "Control the default state for the Create Account checkbox"
182
  msgstr ""
183
 
184
- #: includes/class-wc-customizer-settings.php:317
185
  msgid "Checked"
186
  msgstr ""
187
 
188
- #: includes/class-wc-customizer-settings.php:318
189
  msgid "Unchecked"
190
  msgstr ""
191
 
192
- #: includes/class-wc-customizer-settings.php:325
193
  msgid "Submit Order button"
194
  msgstr ""
195
 
196
- #: includes/class-wc-customizer-settings.php:326
197
  msgid "Changes the Place Order button text on checkout"
198
  msgstr ""
199
 
200
- #: includes/class-wc-customizer-settings.php:339
201
  msgid "Tax"
202
  msgstr ""
203
 
204
- #: includes/class-wc-customizer-settings.php:345
205
  msgid "Tax Label"
206
  msgstr ""
207
 
208
- #: includes/class-wc-customizer-settings.php:346
209
  msgid "Changes the Taxes label. Defaults to Tax for USA, VAT for European countries"
210
  msgstr ""
211
 
212
- #: includes/class-wc-customizer-settings.php:352
213
  msgid "Including Tax Label"
214
  msgstr ""
215
 
216
- #: includes/class-wc-customizer-settings.php:353
217
  msgid ""
218
  "Changes the Including Taxes label. Defaults to Inc. tax for USA, Inc. VAT "
219
  "for European countries"
220
  msgstr ""
221
 
222
- #: includes/class-wc-customizer-settings.php:359
223
  msgid "Excluding Tax Label"
224
  msgstr ""
225
 
226
- #: includes/class-wc-customizer-settings.php:360
227
  msgid ""
228
  "Changes the Excluding Taxes label. Defaults to Exc. tax for USA, Exc. VAT "
229
  "for European countries"
230
  msgstr ""
231
 
232
- #: includes/class-wc-customizer-settings.php:367
233
  msgid "Images"
234
  msgstr ""
235
 
236
- #: includes/class-wc-customizer-settings.php:373
237
  msgid "Placeholder Image source"
238
  msgstr ""
239
 
240
- #: includes/class-wc-customizer-settings.php:374
241
  msgid "Change the default placeholder image by setting this to a valid image URL"
242
  msgstr ""
243
 
@@ -266,18 +297,23 @@ msgstr ""
266
  msgid "You cannot unserialize instances of %s."
267
  msgstr ""
268
 
269
- #: woocommerce-customizer.php:360
270
  msgid "Configure"
271
  msgstr ""
272
 
273
- #: woocommerce-customizer.php:361
274
  msgid "FAQ"
275
  msgstr ""
276
 
277
- #: woocommerce-customizer.php:362
278
  msgid "Support"
279
  msgstr ""
280
 
 
 
 
 
 
281
  #. Plugin Name of the plugin/theme
282
  msgid "WooCommerce Customizer"
283
  msgstr ""
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Customizer 2.5.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/skyverge/woocommerce-customizer/issues\n"
8
  "POT-Creation-Date: 2014-09-05 23:18:53+00:00\n"
30
  msgstr ""
31
 
32
  #: includes/class-wc-customizer-settings.php:65
33
+ #: includes/class-wc-customizer-settings.php:339
34
  msgid "Misc"
35
  msgstr ""
36
 
37
  #: includes/class-wc-customizer-settings.php:148
38
+ #: includes/class-wc-customizer-settings.php:275
39
  msgid "Add to Cart Button Text"
40
  msgstr ""
41
 
74
  msgstr ""
75
 
76
  #: includes/class-wc-customizer-settings.php:183
77
+ #: includes/class-wc-customizer-settings.php:289
78
+ msgid "Sale Flash"
79
  msgstr ""
80
 
81
  #: includes/class-wc-customizer-settings.php:189
82
+ #: includes/class-wc-customizer-settings.php:295
83
+ msgid "Sale badge text"
84
  msgstr ""
85
 
86
  #: includes/class-wc-customizer-settings.php:190
87
+ msgid "Changes text for the sale flash on all loop pages. Default: \"Sale!\""
88
+ msgstr ""
89
+
90
+ #: includes/class-wc-customizer-settings.php:193
91
+ #: includes/class-wc-customizer-settings.php:299
92
+ #. translators: Placeholders: %1$s - <code>, %2$s - </code>
93
+ msgid "Use %1$s{percent}%2$s to insert percent off, e.g., \"{percent} off!\""
94
+ msgstr ""
95
+
96
+ #: includes/class-wc-customizer-settings.php:193
97
+ #: includes/class-wc-customizer-settings.php:299
98
+ msgid ""
99
+ "Shows \"up to n%\" for grouped or variable products if multiple percentages "
100
+ "are possible."
101
+ msgstr ""
102
+
103
+ #: includes/class-wc-customizer-settings.php:199
104
+ msgid "Layout"
105
+ msgstr ""
106
+
107
+ #: includes/class-wc-customizer-settings.php:205
108
+ msgid "Products displayed per page"
109
+ msgstr ""
110
+
111
+ #: includes/class-wc-customizer-settings.php:206
112
  msgid "Changes the number of products displayed per page"
113
  msgstr ""
114
 
115
+ #: includes/class-wc-customizer-settings.php:212
116
  msgid "Product columns displayed per page"
117
  msgstr ""
118
 
119
+ #: includes/class-wc-customizer-settings.php:213
120
  msgid "Changes the number of columns displayed per page"
121
  msgstr ""
122
 
123
+ #: includes/class-wc-customizer-settings.php:219
124
  msgid "Product thumbnail columns displayed"
125
  msgstr ""
126
 
127
+ #: includes/class-wc-customizer-settings.php:220
128
  msgid "Changes the number of product thumbnail columns displayed"
129
  msgstr ""
130
 
131
+ #: includes/class-wc-customizer-settings.php:233
132
  msgid "Tab Titles"
133
  msgstr ""
134
 
135
+ #: includes/class-wc-customizer-settings.php:239
136
+ #: includes/class-wc-customizer-settings.php:260
137
  msgid "Product Description"
138
  msgstr ""
139
 
140
+ #: includes/class-wc-customizer-settings.php:240
141
  msgid "Changes the Production Description tab title"
142
  msgstr ""
143
 
144
+ #: includes/class-wc-customizer-settings.php:246
145
+ #: includes/class-wc-customizer-settings.php:267
146
  msgid "Additional Information"
147
  msgstr ""
148
 
149
+ #: includes/class-wc-customizer-settings.php:247
150
  msgid "Changes the Additional Information tab title"
151
  msgstr ""
152
 
153
+ #: includes/class-wc-customizer-settings.php:254
154
  msgid "Tab Content Headings"
155
  msgstr ""
156
 
157
+ #: includes/class-wc-customizer-settings.php:261
158
  msgid "Changes the Product Description tab heading"
159
  msgstr ""
160
 
161
+ #: includes/class-wc-customizer-settings.php:268
162
  msgid "Changes the Additional Information tab heading"
163
  msgstr ""
164
 
165
+ #: includes/class-wc-customizer-settings.php:281
166
  msgid "All Product Types"
167
  msgstr ""
168
 
169
+ #: includes/class-wc-customizer-settings.php:282
170
  msgid ""
171
  "Changes the Add to Cart button text on the single product page for all "
172
  "product type"
173
  msgstr ""
174
 
175
+ #: includes/class-wc-customizer-settings.php:296
176
+ msgid "Changes text for the sale flash on product pages. Default: \"Sale!\""
177
+ msgstr ""
178
+
179
+ #: includes/class-wc-customizer-settings.php:310
180
  msgid "Messages"
181
  msgstr ""
182
 
183
+ #: includes/class-wc-customizer-settings.php:316
184
  msgid "Must be logged in text"
185
  msgstr ""
186
 
187
+ #: includes/class-wc-customizer-settings.php:317
188
  msgid "Changes the message displayed when a customer must be logged in to checkout"
189
  msgstr ""
190
 
191
+ #: includes/class-wc-customizer-settings.php:323
192
  msgid "Coupon text"
193
  msgstr ""
194
 
195
+ #: includes/class-wc-customizer-settings.php:324
196
  msgid "Changes the message displayed if the coupon form is enabled on checkout"
197
  msgstr ""
198
 
199
+ #: includes/class-wc-customizer-settings.php:331
200
  msgid "Login text"
201
  msgstr ""
202
 
203
+ #: includes/class-wc-customizer-settings.php:332
204
  msgid "Changes the message displayed if customers can login at checkout"
205
  msgstr ""
206
 
207
+ #: includes/class-wc-customizer-settings.php:345
208
  msgid "Create Account checkbox default"
209
  msgstr ""
210
 
211
+ #: includes/class-wc-customizer-settings.php:346
212
  msgid "Control the default state for the Create Account checkbox"
213
  msgstr ""
214
 
215
+ #: includes/class-wc-customizer-settings.php:349
216
  msgid "Checked"
217
  msgstr ""
218
 
219
+ #: includes/class-wc-customizer-settings.php:350
220
  msgid "Unchecked"
221
  msgstr ""
222
 
223
+ #: includes/class-wc-customizer-settings.php:357
224
  msgid "Submit Order button"
225
  msgstr ""
226
 
227
+ #: includes/class-wc-customizer-settings.php:358
228
  msgid "Changes the Place Order button text on checkout"
229
  msgstr ""
230
 
231
+ #: includes/class-wc-customizer-settings.php:371
232
  msgid "Tax"
233
  msgstr ""
234
 
235
+ #: includes/class-wc-customizer-settings.php:377
236
  msgid "Tax Label"
237
  msgstr ""
238
 
239
+ #: includes/class-wc-customizer-settings.php:378
240
  msgid "Changes the Taxes label. Defaults to Tax for USA, VAT for European countries"
241
  msgstr ""
242
 
243
+ #: includes/class-wc-customizer-settings.php:384
244
  msgid "Including Tax Label"
245
  msgstr ""
246
 
247
+ #: includes/class-wc-customizer-settings.php:385
248
  msgid ""
249
  "Changes the Including Taxes label. Defaults to Inc. tax for USA, Inc. VAT "
250
  "for European countries"
251
  msgstr ""
252
 
253
+ #: includes/class-wc-customizer-settings.php:391
254
  msgid "Excluding Tax Label"
255
  msgstr ""
256
 
257
+ #: includes/class-wc-customizer-settings.php:392
258
  msgid ""
259
  "Changes the Excluding Taxes label. Defaults to Exc. tax for USA, Exc. VAT "
260
  "for European countries"
261
  msgstr ""
262
 
263
+ #: includes/class-wc-customizer-settings.php:399
264
  msgid "Images"
265
  msgstr ""
266
 
267
+ #: includes/class-wc-customizer-settings.php:405
268
  msgid "Placeholder Image source"
269
  msgstr ""
270
 
271
+ #: includes/class-wc-customizer-settings.php:406
272
  msgid "Change the default placeholder image by setting this to a valid image URL"
273
  msgstr ""
274
 
297
  msgid "You cannot unserialize instances of %s."
298
  msgstr ""
299
 
300
+ #: woocommerce-customizer.php:409
301
  msgid "Configure"
302
  msgstr ""
303
 
304
+ #: woocommerce-customizer.php:410
305
  msgid "FAQ"
306
  msgstr ""
307
 
308
+ #: woocommerce-customizer.php:411
309
  msgid "Support"
310
  msgstr ""
311
 
312
+ #: woocommerce-customizer.php:456
313
+ #. translators: Placeholder: %s - sale percentage
314
+ msgid "up to %s"
315
+ msgstr ""
316
+
317
  #. Plugin Name of the plugin/theme
318
  msgid "WooCommerce Customizer"
319
  msgstr ""
includes/class-wc-customizer-settings.php CHANGED
@@ -179,6 +179,22 @@ class WC_Customizer_Settings extends WC_Settings_Page {
179
 
180
  array( 'type' => 'sectionend' ),
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  array(
183
  'title' => __( 'Layout', 'woocommerce-customizer' ),
184
  'type' => 'title'
@@ -267,7 +283,23 @@ class WC_Customizer_Settings extends WC_Settings_Page {
267
  'type' => 'text'
268
  ),
269
 
270
- array( 'type' => 'sectionend' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  ),
272
 
273
  'checkout' =>
179
 
180
  array( 'type' => 'sectionend' ),
181
 
182
+ array(
183
+ 'title' => __( 'Sale Flash', 'woocommerce-customizer' ),
184
+ 'type' => 'title'
185
+ ),
186
+
187
+ array(
188
+ 'id' => 'loop_sale_flash_text',
189
+ 'title' => __( 'Sale badge text', 'woocommerce-customizer' ),
190
+ 'desc_tip' => __( 'Changes text for the sale flash on all loop pages. Default: "Sale!"', 'woocommerce-customizer' ),
191
+ 'type' => 'text',
192
+ /* translators: Placeholders: %1$s - <code>, %2$s - </code> */
193
+ 'desc' => sprintf( __( 'Use %1$s{percent}%2$s to insert percent off, e.g., "{percent} off!"', 'woocommerce-customizer' ), '<code>', '</code>' ) . '<br />' . __( 'Shows "up to n%" for grouped or variable products if multiple percentages are possible.', 'woocommerce-customizer' ),
194
+ ),
195
+
196
+ array( 'type' => 'sectionend' ),
197
+
198
  array(
199
  'title' => __( 'Layout', 'woocommerce-customizer' ),
200
  'type' => 'title'
283
  'type' => 'text'
284
  ),
285
 
286
+ array( 'type' => 'sectionend' ),
287
+
288
+ array(
289
+ 'title' => __( 'Sale Flash', 'woocommerce-customizer' ),
290
+ 'type' => 'title'
291
+ ),
292
+
293
+ array(
294
+ 'id' => 'single_sale_flash_text',
295
+ 'title' => __( 'Sale badge text', 'woocommerce-customizer' ),
296
+ 'desc_tip' => __( 'Changes text for the sale flash on product pages. Default: "Sale!"', 'woocommerce-customizer' ),
297
+ 'type' => 'text',
298
+ /* translators: Placeholders: %1$s - <code>, %2$s - </code> */
299
+ 'desc' => sprintf( __( 'Use %1$s{percent}%2$s to insert percent off, e.g., "{percent} off!"', 'woocommerce-customizer' ), '<code>', '</code>' ) . '<br />' . __( 'Shows "up to n%" for grouped or variable products if multiple percentages are possible.', 'woocommerce-customizer' ),
300
+ ),
301
+
302
+ array( 'type' => 'sectionend' ),
303
  ),
304
 
305
  'checkout' =>
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: SkyVerge, maxrice, tamarazuk, chasewiseman, nekojira, beka.rice
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@skyverge.com&item_name=Donation+for+WooCommerce+Customizer
4
  Tags: woocommerce, woocommerce shop, woocommerce filters, woocommerce text
5
  Requires at least: 4.1
6
- Tested up to: 4.7.3
7
  WC requires at least: 2.5.5
8
- WC tested up to: 3.0
9
- Stable tag: 2.4.0
10
  License: GPLv3 or later
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
@@ -14,26 +14,25 @@ Helps you customize WooCommerce without writing any code!
14
 
15
  == Description ==
16
 
17
- WooCommerce includes tons of filters to let you customize button text, labels, and more, but you have to write PHP
18
- code to use them. This plugin provides a settings page where you can add your customizations and save them without
19
- needing to write any code or modify any templates, which is helpful for quick change testing.
20
 
21
  > **Requires** WooCommerce 2.5.5+
22
 
23
  Here are some customizations you can make:
24
 
25
  * Add to Cart button text for different product types (within the shop loop and on a single product page)
 
26
  * The number of products displayed per page
27
- * Heading text for the 'Product Description' and 'Additional Information' tab.
28
  * Checkout page coupon / login text
29
  * Checkout page "Create Account" checkbox default
30
- * Checkout page 'Submit Order' button text
31
  * Tax Label text
32
  * Placeholder image source
33
 
34
  To make these changes, go to **WooCommerce &gt; Settings** and view the "Customizer" tab.
35
 
36
- > **Note**: This plugin does not support multisite and cannot be network activated. To use this on a multisite network, you must activate the plugin individually on each site.
37
 
38
  = Support Details =
39
  We do support our free plugins and extensions, but please understand that support for premium products takes priority. We typically check the forums every few days (with a maximum delay of one week).
@@ -66,14 +65,17 @@ Please submit an issue on [GitHub](https://github.com/skyverge/woocommerce-custo
66
 
67
  = Can I contribute to the plugin? =
68
 
69
- Yes! Fork the plugin on [GitHub](https://github.com/skyverge/woocommerce-customizer/) and send a pull request.
70
 
71
  == Screenshots ==
72
 
73
- 1. Settings Page for customizations galore!
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 2.4.0 =
78
  * Fix - Image placeholder replacements are only shown in the shop, not in the WP admin
79
  * Localization - Includes Persian translation, props [Saakhtani team](http://saakhtani.ir/)!
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@skyverge.com&item_name=Donation+for+WooCommerce+Customizer
4
  Tags: woocommerce, woocommerce shop, woocommerce filters, woocommerce text
5
  Requires at least: 4.1
6
+ Tested up to: 4.7.4
7
  WC requires at least: 2.5.5
8
+ WC tested up to: 3.0.7
9
+ Stable tag: 2.5.0
10
  License: GPLv3 or later
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
14
 
15
  == Description ==
16
 
17
+ WooCommerce includes tons of filters to let you customize button text, labels, and more, but you have to write PHP code to use them. This plugin provides a settings page where you can add your customizations and save them without needing to write any code or modify any templates, which is helpful for quick change testing.
 
 
18
 
19
  > **Requires** WooCommerce 2.5.5+
20
 
21
  Here are some customizations you can make:
22
 
23
  * Add to Cart button text for different product types (within the shop loop and on a single product page)
24
+ * Sales badge text for the shop or product pages
25
  * The number of products displayed per page
26
+ * Heading text for the "Product Description" and "Additional Information" tab.
27
  * Checkout page coupon / login text
28
  * Checkout page "Create Account" checkbox default
29
+ * Checkout page "Submit Order" button text
30
  * Tax Label text
31
  * Placeholder image source
32
 
33
  To make these changes, go to **WooCommerce &gt; Settings** and view the "Customizer" tab.
34
 
35
+ > **Note**: This plugin does not support being network activated on multisite. To use this on a multisite network, you must activate the plugin individually on each site.
36
 
37
  = Support Details =
38
  We do support our free plugins and extensions, but please understand that support for premium products takes priority. We typically check the forums every few days (with a maximum delay of one week).
65
 
66
  = Can I contribute to the plugin? =
67
 
68
+ Of course! Please fork the [GitHub](https://github.com/skyverge/woocommerce-customizer/) repository and send a pull request.
69
 
70
  == Screenshots ==
71
 
72
+ 1. Settings Page to start customizing!
73
 
74
  == Changelog ==
75
 
76
+ = 2.5.0 =
77
+ * Feature - Added sales badge text customization
78
+
79
  = 2.4.0 =
80
  * Fix - Image placeholder replacements are only shown in the shop, not in the WP admin
81
  * Localization - Includes Persian translation, props [Saakhtani team](http://saakhtani.ir/)!
woocommerce-customizer.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Customize WooCommerce without code! Easily change add to cart button text and more.
6
  * Author: SkyVerge
7
  * Author URI: http://www.skyverge.com
8
- * Version: 2.4.0
9
  * Text Domain: woocommerce-customizer
10
  * Domain Path: /i18n/languages/
11
  *
@@ -111,7 +111,7 @@ class WC_Customizer {
111
 
112
 
113
  /** plugin version number */
114
- const VERSION = '2.4.0';
115
 
116
  /** @var \WC_Customizer single instance of this plugin */
117
  protected static $instance;
@@ -222,6 +222,10 @@ class WC_Customizer {
222
  add_filter( $filter_name, array( $this, 'customize' ) );
223
  }
224
 
 
 
 
 
225
  } else {
226
 
227
  add_filter( $filter_name, array( $this, 'customize' ) );
@@ -343,6 +347,51 @@ class WC_Customizer {
343
  }
344
 
345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  /** Admin methods ******************************************************/
347
 
348
 
@@ -358,7 +407,7 @@ class WC_Customizer {
358
 
359
  $custom_actions = array(
360
  'configure' => sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=wc-settings&tab=customizer&section=shop_loop' ), __( 'Configure', 'woocommerce-customizer' ) ),
361
- 'faq' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/plugins/woocommerce-customizer/faq/', __( 'FAQ', 'woocommerce-customizer' ) ),
362
  'support' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/support/plugin/woocommerce-customizer', __( 'Support', 'woocommerce-customizer' ) ),
363
  );
364
 
@@ -370,6 +419,76 @@ class WC_Customizer {
370
  /** Helper methods ******************************************************/
371
 
372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  /**
374
  * Main Customizer Instance, ensures only one instance is/can be loaded
375
  *
5
  * Description: Customize WooCommerce without code! Easily change add to cart button text and more.
6
  * Author: SkyVerge
7
  * Author URI: http://www.skyverge.com
8
+ * Version: 2.5.0
9
  * Text Domain: woocommerce-customizer
10
  * Domain Path: /i18n/languages/
11
  *
111
 
112
 
113
  /** plugin version number */
114
+ const VERSION = '2.5.0';
115
 
116
  /** @var \WC_Customizer single instance of this plugin */
117
  protected static $instance;
222
  add_filter( $filter_name, array( $this, 'customize' ) );
223
  }
224
 
225
+ } elseif ( 'loop_sale_flash_text' === $filter_name || 'single_sale_flash_text' === $filter_name ) {
226
+
227
+ add_filter( 'woocommerce_sale_flash', array( $this, 'customize_woocommerce_sale_flash' ), 50, 3 );
228
+
229
  } else {
230
 
231
  add_filter( $filter_name, array( $this, 'customize' ) );
347
  }
348
 
349
 
350
+ /**
351
+ * Apply the shop loop sale flash text customization.
352
+ *
353
+ * @since 2.5.0
354
+ *
355
+ * @param string $html add to cart flash HTML
356
+ * @param \WP_Post $_ post object, unused
357
+ * @param \WC_Product $product the prdouct object
358
+ * @return string updated HTML
359
+ */
360
+ public function customize_woocommerce_sale_flash( $html, $_, $product ) {
361
+
362
+ if ( is_product() && isset( $this->filters['single_sale_flash_text'] ) ) {
363
+
364
+ $text = $this->filters['single_sale_flash_text'];
365
+
366
+ // only get sales percentages when we should be replacing text
367
+ // check "false" specifically since the position could be 0
368
+ if ( false !== strpos( $text, '{percent}' ) ) {
369
+
370
+ $percent = $this->get_sale_percentage( $product );
371
+ $text = str_replace( '{percent}', "{$percent}%", $text );
372
+ }
373
+
374
+ $html = "<span class='onsale'>{$text}</span>";
375
+
376
+ } elseif ( ! is_product() && isset( $this->filters['loop_sale_flash_text'] ) ) {
377
+
378
+ $text = $this->filters['loop_sale_flash_text'];
379
+
380
+ // only check for sales percentages when we should be replacing text
381
+ // check "false" specifically since the position could be 0
382
+ if ( false !== strpos( $text, '{percent}' ) ) {
383
+
384
+ $percent = $this->get_sale_percentage( $product );
385
+ $text = str_replace( '{percent}', "{$percent}%", $text );
386
+ }
387
+
388
+ $html = "<span class='onsale'>{$text}</span>";
389
+ }
390
+
391
+ return $html;
392
+ }
393
+
394
+
395
  /** Admin methods ******************************************************/
396
 
397
 
407
 
408
  $custom_actions = array(
409
  'configure' => sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=wc-settings&tab=customizer&section=shop_loop' ), __( 'Configure', 'woocommerce-customizer' ) ),
410
+ 'faq' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/plugins/woocommerce-customizer/#faq', __( 'FAQ', 'woocommerce-customizer' ) ),
411
  'support' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/support/plugin/woocommerce-customizer', __( 'Support', 'woocommerce-customizer' ) ),
412
  );
413
 
419
  /** Helper methods ******************************************************/
420
 
421
 
422
+ /**
423
+ * Helper to get the percent discount for a product on sale.
424
+ *
425
+ * @since 2.5.0
426
+ *
427
+ * @param \WC_Product $product product instance
428
+ * @return string percentage discount
429
+ */
430
+ private function get_sale_percentage( $product ) {
431
+
432
+ $child_sale_percents = array();
433
+ $percentage = '0';
434
+
435
+ if ( $product->is_type( 'grouped' ) || $product->is_type( 'variable' ) ) {
436
+
437
+ foreach ( $product->get_children() as $child_id ) {
438
+
439
+ $child = wc_get_product( $child_id );
440
+
441
+ if ( $child->is_on_sale() ) {
442
+
443
+ $regular_price = $child->get_regular_price();
444
+ $sale_price = $child->get_sale_price();
445
+ $child_sale_percents[] = $this->calculate_sale_percentage( $regular_price, $sale_price );
446
+ }
447
+ }
448
+
449
+ // filter out duplicate values
450
+ $child_sale_percents = array_unique( $child_sale_percents );
451
+
452
+ // only add "up to" if there's > 1 percentage possible
453
+ if ( ! empty ( $child_sale_percents ) ) {
454
+
455
+ /* translators: Placeholder: %s - sale percentage */
456
+ $percentage = count( $child_sale_percents ) > 1 ? sprintf( esc_html__( 'up to %s', 'woocommerce-customizer' ), max( $child_sale_percents ) ) : current( $child_sale_percents );
457
+ }
458
+
459
+ } else {
460
+
461
+ $percentage = $this->calculate_sale_percentage( $product->get_regular_price(), $product->get_sale_price() );
462
+ }
463
+
464
+ return $percentage;
465
+ }
466
+
467
+
468
+ /**
469
+ * Calculates a sales percentage difference given regular and sale prices for a product.
470
+ *
471
+ * @since 2.5.0
472
+ *
473
+ * @param string $regular_price product regular price
474
+ * @param string $sale_price product sale price
475
+ * @return float percentage difference
476
+ */
477
+ private function calculate_sale_percentage( $regular_price, $sale_price ) {
478
+
479
+ $percent = 0;
480
+ $regular = (float) $regular_price;
481
+ $sale = (float) $sale_price;
482
+
483
+ // in case of free products so we don't divide by 0
484
+ if ( $regular ) {
485
+ $percent = round( ( ( $regular - $sale ) / $regular ) * 100 );
486
+ }
487
+
488
+ return $percent;
489
+ }
490
+
491
+
492
  /**
493
  * Main Customizer Instance, ensures only one instance is/can be loaded
494
  *