├── .editorconfig
├── .gitignore
├── LICENSE
├── assets
└── js
│ ├── customize-controls.js
│ ├── customize-controls.min.js
│ └── customize-controls.min.js.map
├── exclude-patterns.txt
├── i18n
└── languages
│ ├── woocommerce-extra-product-sorting-options-fr_FR.mo
│ ├── woocommerce-extra-product-sorting-options-fr_FR.po
│ └── woocommerce-extra-product-sorting-options.pot
├── includes
└── class-wc-eso-customizer-checkbox-multiple.php
├── package.json
├── readme.md
├── readme.txt
├── sake.config.js
├── tool.tartufo
├── woocommerce-extra-product-sorting-options.php
└── wp-assets
├── banner-772x250.png
├── icon-256x256.png
├── screenshot-1.png
├── screenshot-2.png
└── screenshot-3.png
/.editorconfig:
--------------------------------------------------------------------------------
1 | # This file is for unifying the coding style for different editors and IDEs
2 | # editorconfig.org
3 |
4 | # WordPress Coding Standards
5 | # http://make.wordpress.org/core/handbook/coding-standards/
6 |
7 | root = true
8 |
9 | [*]
10 | charset = utf-8
11 | end_of_line = lf
12 | insert_final_newline = true
13 | trim_trailing_whitespace = true
14 | indent_style = tab
15 |
16 | [{.jshintrc,*.json,*.toml,*.yml}]
17 | indent_style = space
18 | indent_size = 2
19 |
20 | [{*.txt}]
21 | end_of_line = crlf
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.zip
2 | .DS_Store
3 |
4 | # Grunt.js SASS cache files
5 | /.sass-cache
6 |
7 | # NPM packages used by Grunt.js
8 | /node_modules
9 |
10 | # NPM debug log
11 | npm-debug.log
12 | package-lock.json
13 |
14 | # build directory
15 | /build
16 |
17 | .idea/
18 | /svn
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/assets/js/customize-controls.js:
--------------------------------------------------------------------------------
1 | jQuery( document ).ready( function( $ ) {
2 | 'use strict';
3 |
4 | /* === Checkbox Multiple Control === */
5 |
6 | $( '.customize-control-checkbox-multiple input[type="checkbox"]' ).on( 'change', function() {
7 |
8 | var $checkbox_values = $( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]:checked' ).map( function() {
9 | return this.value;
10 | } ).get().join( ',' );
11 |
12 | $( this ).parents( '.customize-control' ).find( 'input[type="hidden"]' ).val( $checkbox_values ).trigger( 'change' );
13 | } );
14 | } );
15 |
--------------------------------------------------------------------------------
/assets/js/customize-controls.min.js:
--------------------------------------------------------------------------------
1 | jQuery(document).ready(function(e){e('.customize-control-checkbox-multiple input[type="checkbox"]').on("change",function(){var t=e(this).parents(".customize-control").find('input[type="checkbox"]:checked').map(function(){return this.value}).get().join(",");e(this).parents(".customize-control").find('input[type="hidden"]').val(t).trigger("change")})});
2 | //# sourceMappingURL=customize-controls.min.js.map
3 |
--------------------------------------------------------------------------------
/assets/js/customize-controls.min.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["../customize-controls.js"],"names":["jQuery","document","ready","$","on","$checkbox_values","this","parents","find","map","value","get","join","val","trigger"],"mappings":"AAAAA,OAAQC,QAAS,EAAEC,MAAO,SAAUC,GAKnCA,EAFA,6DAAA,EAAAC,GAAA,SAAA,WAIC,IAAAC,EAAoBF,EAAIG,IAAO,EAAEC,QAAS,oBAAuBC,EAAAA,KAAM,gCAAmCC,EAAKA,IAAA,WAC9G,OAAAH,KAAOI,KACR,CAAA,EAAGC,IAAI,EAAEC,KAAO,GAAK,EAGtBT,EAAGG,IAAA,EAAAC,QAAA,oBAAA,EAAAC,KAAA,sBAAA,EAAAK,IAAAR,CAAA,EAAAS,QAAA,QAAA,CACF,CAAC,CAAH,CAAE","file":"customize-controls.min.js"}
--------------------------------------------------------------------------------
/exclude-patterns.txt:
--------------------------------------------------------------------------------
1 | resources/js/app.js
2 | resources/vendor
3 | (.*/)?autoload.php
4 | sample.env
5 | # Library Folders
6 | node_modules
7 | (.*/)?node_modules/
8 | vendor
9 | (.*/)?vendor/
10 | # Lock Files are not always in the root
11 | .*composer.lock
12 | .*package.json
13 | .*package-lock.json
14 | .pnp.js
15 | .*Pipfile.lock
16 | .*yarn.lock
17 | # Ignore inline images
18 | .*\.css$
19 | .*\.scss$
20 | .*\.ico$
21 | .*\.jpg$
22 | .*\.png$
23 | .*\.svg$
24 | # Ignore uploaded logs
25 | .*\.log$
26 | # Frontend Build Files
27 | build
28 | data
29 | public/js/app.js
30 |
--------------------------------------------------------------------------------
/i18n/languages/woocommerce-extra-product-sorting-options-fr_FR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/godaddy-wordpress/woocommerce-extra-product-sorting-options/32cb4061d5cc22984e9e27acf92dfc333e88f5ce/i18n/languages/woocommerce-extra-product-sorting-options-fr_FR.mo
--------------------------------------------------------------------------------
/i18n/languages/woocommerce-extra-product-sorting-options-fr_FR.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2018 SkyVerge
2 | # This file is distributed under the GNU General Public License v3.0.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: WooCommerce Extra Product Sorting Options 2.7.1\n"
6 | "Report-Msgid-Bugs-To: https://github.com/skyverge/woocommerce-extra-product-"
7 | "sorting-options/issues\n"
8 | "POT-Creation-Date: 2018-02-13 20:02:28+00:00\n"
9 | "MIME-Version: 1.0\n"
10 | "Content-Type: text/plain; charset=UTF-8\n"
11 | "Content-Transfer-Encoding: 8bit\n"
12 | "PO-Revision-Date: 2018-04-24 11:26+0200\n"
13 | "Language-Team: \n"
14 | "X-Generator: Poedit 2.0.6\n"
15 | "Last-Translator: \n"
16 | "Plural-Forms: nplurals=2; plural=(n > 1);\n"
17 | "Language: fr\n"
18 |
19 | #: build/woocommerce-extra-product-sorting-options.php:128
20 | #: build/woocommerce-extra-product-sorting-options.php:199
21 | #: woocommerce-extra-product-sorting-options.php:128
22 | #: woocommerce-extra-product-sorting-options.php:199
23 | msgid "New Default Sorting Label"
24 | msgstr "Nouveau label pour le tri par défaut"
25 |
26 | #: build/woocommerce-extra-product-sorting-options.php:132
27 | #: build/woocommerce-extra-product-sorting-options.php:200
28 | #: woocommerce-extra-product-sorting-options.php:132
29 | #: woocommerce-extra-product-sorting-options.php:200
30 | msgid ""
31 | "If desired, enter a new name for the default sorting option, e.g., "Our "
32 | "Sorting""
33 | msgstr ""
34 | "Si souhaité, entrez un nouveau nom pour lotion de tri par défaut, par "
35 | "exemple "Notre tri""
36 |
37 | #: build/woocommerce-extra-product-sorting-options.php:136
38 | #: build/woocommerce-extra-product-sorting-options.php:222
39 | #: woocommerce-extra-product-sorting-options.php:136
40 | #: woocommerce-extra-product-sorting-options.php:222
41 | msgid "Add Product Sorting:"
42 | msgstr "Ajoutez le tri de produit:"
43 |
44 | #: build/woocommerce-extra-product-sorting-options.php:137
45 | #: woocommerce-extra-product-sorting-options.php:137
46 | msgid ""
47 | "Select sorting options to add to your shop. \"Available Stock\" sorts "
48 | "products with the most stock first."
49 | msgstr ""
50 | "Sélectionnez les options de tri à ajouter à votre boutique. « Stock "
51 | "disponible » trie les produits avec le plus de stock en premier."
52 |
53 | #. translators: Placeholders: %1$s - , %2$s - , %3$s - ,
54 | #. %4$s -
55 | #: build/woocommerce-extra-product-sorting-options.php:139
56 | #: woocommerce-extra-product-sorting-options.php:139
57 | msgid ""
58 | "\"On-sale First\" shows %1$ssimple%2$s products on sale first; %3$ssee "
59 | "documentation%4$s for more details."
60 | msgstr ""
61 | "« En vente d’abord » montre les produits en vente %1$ssimples%2$s en "
62 | "premier; %3$sregarder la documentation%4$s pour plus de détail."
63 |
64 | #: build/woocommerce-extra-product-sorting-options.php:149
65 | #: woocommerce-extra-product-sorting-options.php:149
66 | msgid "Select sorting options to add to your shop."
67 | msgstr "Sélectionnez les options de tri à ajouter à votre boutique."
68 |
69 | #. translators: Placeholders: %1$s - , %2$s -
70 | #: build/woocommerce-extra-product-sorting-options.php:224
71 | #: woocommerce-extra-product-sorting-options.php:224
72 | msgid ""
73 | "Select sorting options to add to your shop. %1$ssee documentation%2$s for "
74 | "more details."
75 | msgstr ""
76 | "Select sorting options to add to your shop. %1$ssee documentation%2$s for "
77 | "more details.\n"
78 | "Sélectionnez les options de tri à ajouter à votre boutique. %1$sRegarder la "
79 | "documentation%2$s pour plus de détails."
80 |
81 | #: build/woocommerce-extra-product-sorting-options.php:265
82 | #: woocommerce-extra-product-sorting-options.php:265
83 | msgid "Name: A to Z"
84 | msgstr "Nom: de A à Z"
85 |
86 | #: build/woocommerce-extra-product-sorting-options.php:266
87 | #: woocommerce-extra-product-sorting-options.php:266
88 | msgid "Name: Z to A"
89 | msgstr "Nom: de Z à A"
90 |
91 | #: build/woocommerce-extra-product-sorting-options.php:267
92 | #: woocommerce-extra-product-sorting-options.php:267
93 | msgid "Available Stock"
94 | msgstr "Stock disponible"
95 |
96 | #: build/woocommerce-extra-product-sorting-options.php:268
97 | #: woocommerce-extra-product-sorting-options.php:268
98 | msgid "Review Count"
99 | msgstr "Nombre d’avis"
100 |
101 | #: build/woocommerce-extra-product-sorting-options.php:269
102 | #: woocommerce-extra-product-sorting-options.php:269
103 | msgid "On-sale First"
104 | msgstr "En vente d’abord"
105 |
106 | #: build/woocommerce-extra-product-sorting-options.php:273
107 | #: woocommerce-extra-product-sorting-options.php:273
108 | msgid "Featured First"
109 | msgstr "Produits vedettes en premier"
110 |
111 | #: build/woocommerce-extra-product-sorting-options.php:294
112 | #: woocommerce-extra-product-sorting-options.php:294
113 | msgid "Default sorting"
114 | msgstr "Tri par défaut"
115 |
116 | #: build/woocommerce-extra-product-sorting-options.php:306
117 | #: woocommerce-extra-product-sorting-options.php:306
118 | msgid "Sort by name: A to Z"
119 | msgstr "Tri par nom: de A à Z"
120 |
121 | #: build/woocommerce-extra-product-sorting-options.php:310
122 | #: woocommerce-extra-product-sorting-options.php:310
123 | msgid "Sort by name: Z to A"
124 | msgstr "Tri par nom: de Z à A"
125 |
126 | #: build/woocommerce-extra-product-sorting-options.php:314
127 | #: woocommerce-extra-product-sorting-options.php:314
128 | msgid "Sort by availability"
129 | msgstr "Tri par disponibilité"
130 |
131 | #: build/woocommerce-extra-product-sorting-options.php:318
132 | #: woocommerce-extra-product-sorting-options.php:318
133 | msgid "Sort by review count"
134 | msgstr "Tri par nombre d’avis"
135 |
136 | #: build/woocommerce-extra-product-sorting-options.php:322
137 | #: woocommerce-extra-product-sorting-options.php:322
138 | msgid "Show sale items first"
139 | msgstr "Monter les articles en vente en premier"
140 |
141 | #: build/woocommerce-extra-product-sorting-options.php:327
142 | #: woocommerce-extra-product-sorting-options.php:327
143 | msgid "Show featured items first"
144 | msgstr "Montrer les articles vedettes en premier"
145 |
146 | #. translators: Placeholders: %s - plugin name
147 | #: build/woocommerce-extra-product-sorting-options.php:443
148 | #: woocommerce-extra-product-sorting-options.php:443
149 | msgid "You cannot clone instances of %s."
150 | msgstr "Vous ne pouvez pas cloner les instances de %s."
151 |
152 | #. translators: Placeholders: %s - plugin name
153 | #: build/woocommerce-extra-product-sorting-options.php:454
154 | #: woocommerce-extra-product-sorting-options.php:454
155 | msgid "You cannot unserialize instances of %s."
156 | msgstr "Vous ne pouvez pas déserializer les instances de %s."
157 |
158 | #: build/woocommerce-extra-product-sorting-options.php:474
159 | #: woocommerce-extra-product-sorting-options.php:474
160 | msgid "Configure"
161 | msgstr "Configurer"
162 |
163 | #: build/woocommerce-extra-product-sorting-options.php:475
164 | #: woocommerce-extra-product-sorting-options.php:475
165 | msgid "FAQ"
166 | msgstr "FAQ"
167 |
168 | #: build/woocommerce-extra-product-sorting-options.php:476
169 | #: woocommerce-extra-product-sorting-options.php:476
170 | msgid "Support"
171 | msgstr "Support"
172 |
173 | #. translators: Placeholders: %1$s , %2$s - , %3$s and %5$s -
174 | #. tags, %4$s -
175 | #: build/woocommerce-extra-product-sorting-options.php:521
176 | #: woocommerce-extra-product-sorting-options.php:521
177 | msgid ""
178 | "%1$sWooCommerce Extra Product Sorting Options is inactive.%2$s This plugin "
179 | "requires WooCommerce 2.6.14 or newer. Please %3$supdate WooCommerce%4$s or "
180 | "%5$srun the WooCommerce database upgrade%4$s."
181 | msgstr ""
182 | "%1$sWooCommerce Extra Product Sorting Options est inactif.%2$s Ce plugin "
183 | "nécessite WooCommerce 2.6.14 ou plus récent. Merci %3$sde mettre à jour "
184 | "WooCommerce%4$s ou %5$sexécuter la mise à jour de la base de données "
185 | "WooCommerce%4$s."
186 |
187 | #. translators: Placeholders: %1$s - , %2$s - , %3$s - ,
188 | #. %4$s -
189 | #: build/woocommerce-extra-product-sorting-options.php:676
190 | #: woocommerce-extra-product-sorting-options.php:676
191 | msgid ""
192 | "%1$sWooCommerce Extra Product Sorting Options settings have changed.%2$s "
193 | "Random sorting is now disabled. If you need to re-add this option, please "
194 | "%3$sview our plugin notes%4$s."
195 | msgstr ""
196 | "%1$sLa configuration de WooCommerce Extra Product Sorting Options a été "
197 | "changée.%2$s Le tri aléatoire est maintenant désactivé. Si vous avez besoin "
198 | "de le réactiver, merci %3$sde consulter les notes de notre plugin%4$s."
199 |
200 | #. translators: Placeholders: %1$s - , %2$s - , %3$s - ,
201 | #. %4$s -
202 | #: build/woocommerce-extra-product-sorting-options.php:698
203 | #: woocommerce-extra-product-sorting-options.php:698
204 | msgid ""
205 | "%1$sWooCommerce Extra Product Sorting Options settings have changed.%2$s "
206 | "Featured sorting is no longer possible with WooCommerce 3.0+ as this product "
207 | "data has changed. Please %3$sview our plugin notes%4$s for more details."
208 | msgstr ""
209 | "%1$sLa configuration de WooCommerce Extra Product Sorting Options a été "
210 | "changée.%2$s Le tri par articles vedettes n’est plus disponible avec "
211 | "WooCommerce 3.0+ car les données de ce produit ont changés. Merci %3$sde "
212 | "consulter les notes de notre plugin%4$s pour plus de détail."
213 |
214 | #. translators: Placeholders: %1$s - , %2$s - , %3$s - ,
215 | #. %4$s -
216 | #: build/woocommerce-extra-product-sorting-options.php:703
217 | #: woocommerce-extra-product-sorting-options.php:703
218 | msgid ""
219 | "Please note: %1$sWooCommerce Extra Product Sorting Options settings%2$s will "
220 | "change when you upgrade to WooCommerce 3.0+. Featured sorting is not "
221 | "possible with WooCommerce 3.0+ as this product data will change. Please "
222 | "%3$sview our plugin notes%4$s for more details."
223 | msgstr ""
224 | "Merci de considérer ceci: %1$sLa configuration de WooCommerce Extra Product "
225 | "Sorting Options%2$s va changer lorsque vous allez migrer à WooCommerce 3.0+. "
226 | "Le tri par produits vedettes n’est plus disponible avec WooCommerce 3.0+ car "
227 | "les données de ce produit vont changer. Merci %3$sde consulter les notes de "
228 | "notre plugin%4$s pour plus de détail."
229 |
230 | #. Plugin Name of the plugin/theme
231 | msgid "WooCommerce Extra Product Sorting Options"
232 | msgstr "WooCommerce Extra Product Sorting Options"
233 |
234 | #. Plugin URI of the plugin/theme
235 | msgid ""
236 | "http://www.skyverge.com/product/woocommerce-extra-product-sorting-options/"
237 | msgstr ""
238 | "http://www.skyverge.com/product/woocommerce-extra-product-sorting-options/"
239 |
240 | #. Description of the plugin/theme
241 | msgid "Rename default sorting and optionally extra product sorting options."
242 | msgstr ""
243 | "Renommer le tri par défaut et, de manière optionnelle, les options "
244 | "additionnelles de tri de produit."
245 |
246 | #. Author of the plugin/theme
247 | msgid "SkyVerge"
248 | msgstr "SkyVerge"
249 |
250 | #. Author URI of the plugin/theme
251 | msgid "http://www.skyverge.com/"
252 | msgstr "http://www.skyverge.com/"
253 |
254 |
--------------------------------------------------------------------------------
/i18n/languages/woocommerce-extra-product-sorting-options.pot:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2025 SkyVerge
2 | # This file is distributed under the GNU General Public License v3.0.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Extra Product Sorting Options for WooCommerce 2.11.0\n"
6 | "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-extra-product-sorting-options\n"
7 | "Last-Translator: FULL NAME \n"
8 | "Language-Team: LANGUAGE \n"
9 | "MIME-Version: 1.0\n"
10 | "Content-Type: text/plain; charset=UTF-8\n"
11 | "Content-Transfer-Encoding: 8bit\n"
12 | "POT-Creation-Date: 2025-03-25T10:42:21+00:00\n"
13 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14 | "X-Generator: WP-CLI 2.11.0\n"
15 | "X-Domain: woocommerce-extra-product-sorting-options\n"
16 |
17 | #. Plugin Name of the plugin
18 | #: woocommerce-extra-product-sorting-options.php
19 | msgid "Extra Product Sorting Options for WooCommerce"
20 | msgstr ""
21 |
22 | #. Plugin URI of the plugin
23 | #: woocommerce-extra-product-sorting-options.php
24 | msgid "http://www.skyverge.com/product/woocommerce-extra-product-sorting-options/"
25 | msgstr ""
26 |
27 | #. Description of the plugin
28 | #: woocommerce-extra-product-sorting-options.php
29 | msgid "Rename default sorting and optionally extra product sorting options."
30 | msgstr ""
31 |
32 | #. Author of the plugin
33 | #: woocommerce-extra-product-sorting-options.php
34 | msgid "SkyVerge"
35 | msgstr ""
36 |
37 | #. Author URI of the plugin
38 | #: woocommerce-extra-product-sorting-options.php
39 | msgid "http://www.skyverge.com/"
40 | msgstr ""
41 |
42 | #: woocommerce-extra-product-sorting-options.php:150
43 | msgid "New Default Sorting Label"
44 | msgstr ""
45 |
46 | #: woocommerce-extra-product-sorting-options.php:151
47 | msgid "If desired, enter a new name for the default sorting option, e.g., "Our Sorting""
48 | msgstr ""
49 |
50 | #: woocommerce-extra-product-sorting-options.php:173
51 | msgid "Add Product Sorting:"
52 | msgstr ""
53 |
54 | #. translators: Placeholders: %1$s - , %2$s -
55 | #: woocommerce-extra-product-sorting-options.php:176
56 | msgid "Select sorting options to add to your shop. %1$ssee documentation%2$s for more details."
57 | msgstr ""
58 |
59 | #: woocommerce-extra-product-sorting-options.php:201
60 | msgid "Remove Product Sorting:"
61 | msgstr ""
62 |
63 | #. translators: Placeholders: %1$s - , %2$s -
64 | #: woocommerce-extra-product-sorting-options.php:204
65 | msgid "Select default sorting options to remove from your shop. %1$ssee documentation%2$s for more details."
66 | msgstr ""
67 |
68 | #: woocommerce-extra-product-sorting-options.php:246
69 | msgid "Name: A to Z"
70 | msgstr ""
71 |
72 | #: woocommerce-extra-product-sorting-options.php:247
73 | msgid "Name: Z to A"
74 | msgstr ""
75 |
76 | #: woocommerce-extra-product-sorting-options.php:248
77 | msgid "Available Stock"
78 | msgstr ""
79 |
80 | #: woocommerce-extra-product-sorting-options.php:249
81 | msgid "Review Count"
82 | msgstr ""
83 |
84 | #: woocommerce-extra-product-sorting-options.php:250
85 | msgid "On-sale First"
86 | msgstr ""
87 |
88 | #: woocommerce-extra-product-sorting-options.php:347
89 | msgid "Sort by name: A to Z"
90 | msgstr ""
91 |
92 | #: woocommerce-extra-product-sorting-options.php:350
93 | msgid "Sort by name: Z to A"
94 | msgstr ""
95 |
96 | #: woocommerce-extra-product-sorting-options.php:353
97 | msgid "Sort by availability"
98 | msgstr ""
99 |
100 | #: woocommerce-extra-product-sorting-options.php:356
101 | msgid "Sort by review count"
102 | msgstr ""
103 |
104 | #: woocommerce-extra-product-sorting-options.php:359
105 | msgid "Show sale items first"
106 | msgstr ""
107 |
108 | #. translators: Placeholders: %s - plugin name
109 | #: woocommerce-extra-product-sorting-options.php:592
110 | msgid "You cannot clone instances of %s."
111 | msgstr ""
112 |
113 | #. translators: Placeholders: %s - plugin name
114 | #: woocommerce-extra-product-sorting-options.php:603
115 | msgid "You cannot unserialize instances of %s."
116 | msgstr ""
117 |
118 | #: woocommerce-extra-product-sorting-options.php:621
119 | msgid "Configure"
120 | msgstr ""
121 |
122 | #: woocommerce-extra-product-sorting-options.php:622
123 | msgid "FAQ"
124 | msgstr ""
125 |
126 | #: woocommerce-extra-product-sorting-options.php:623
127 | msgid "Support"
128 | msgstr ""
129 |
130 | #. translators: Placeholders: %1$s , %2$s - , %3$s - version number, %4$s - opening HTML link tag, %5$s - closing HTML link tag, %6$s - opening HTML link tag, %7$s - closing HTML link tag
131 | #: woocommerce-extra-product-sorting-options.php:695
132 | msgid "%1$sExtra Product Sorting Options for WooCommerce is inactive.%2$s This plugin requires WooCommerce %3$s or newer. Please %4$supdate WooCommerce%5$s or %6$srun the WooCommerce database upgrade%7$s."
133 | msgstr ""
134 |
135 | #. translators: Placeholders: %1$s - , %2$s - , %3$s - , %4$s -
136 | #: woocommerce-extra-product-sorting-options.php:879
137 | msgid "%1$sExtra Product Sorting Options for WooCommerce settings have changed.%2$s Random sorting is now disabled. If you need to re-add this option, please %3$sview our plugin notes%4$s."
138 | msgstr ""
139 |
140 | #. translators: Placeholders: %1$s - , %2$s - , %3$s - , %4$s -
141 | #: woocommerce-extra-product-sorting-options.php:903
142 | msgid "%1$sExtra Product Sorting Options for WooCommerce settings have changed.%2$s Featured sorting is no longer possible with WooCommerce 3.0+ as this product data has changed. Please %3$sview our plugin notes%4$s for more details."
143 | msgstr ""
144 |
--------------------------------------------------------------------------------
/includes/class-wc-eso-customizer-checkbox-multiple.php:
--------------------------------------------------------------------------------
1 | get_plugin_url() ) . 'assets/js/customize-controls.js', array( 'jquery' ), WC_Extra_Sorting_Options::VERSION, true );
44 | }
45 |
46 |
47 | /**
48 | * Displays the control content.
49 | *
50 | * @since 2.7.0
51 | */
52 | public function render_content() {
53 |
54 | if ( ! empty( $this->choices ) ) : ?>
55 |
56 | label ) ) : ?>
57 | label ); ?>
58 |
59 |
60 | description ) ) : ?>
61 | description ); ?>
62 |
63 |
64 | value() ) ? explode( ',', $this->value() ) : $this->value(); ?>
65 |
66 |
67 | choices as $value => $label ) : ?>
68 |
69 |
70 |
74 |
75 |
76 |
77 |
78 |
79 | link(); ?> value="" />
80 | **Requires: PHP 7.4, WooCommerce 3.9+ and WordPress 5.6+**
19 |
20 | = Features =
21 | Includes options to:
22 |
23 | - rename default product sorting (i.e., change to "Our Sorting")
24 | - enable alphabetical product sorting
25 | - enable reverse alphabetical sorting
26 | - enable on sale sorting (**note**: works only for simple products)
27 | - enable sorting by inventory / availability
28 | - enable sorting by review count (most reviews to least)
29 | - remove core sorting options
30 |
31 | = Rename Default Sorting =
32 | You can customize your product sorting order on your shop pages - [here's a handy tutorial](http://www.sellwithwp.com/create-woocommerce-custom-product-sorting/) to do so. However, many shop admins like to then rename this from "Default Sorting" to something more descriptive, such as "Our Sorting" or "Our Selection". You can optionally enter a new name for this sorting order if desired.
33 |
34 | = Adding Sorting Options =
35 | When you create a customized sorting order, you lose the ability to sort products alphabetically. This plugin gives you the ability to add new sorting options to list products by title A to Z or in reverse order (Z to A).
36 |
37 | Want to show items with the highest stock first? You can enable sorting by availability, which will enable sorting from high stock to low stock (See FAQ for more details). You can also sort by the number of product reviews.
38 |
39 | You can add the option to sort items by sale status - there's a sorting option to show "On Sale" items first in the shop catalog. Please note that only simple products can be sorted by sale status, and variable products will display mixed with non-sale products.
40 |
41 | = Remove Sorting Options =
42 | You can remove the core sorting options as well! If all sorting options have been removed, the sorting dropdown will become hidden on shop pages.
43 |
44 | = Translations =
45 | **The plugin text domain is**: `woocommerce-extra-product-sorting-options`
46 |
47 | = More Details =
48 | - View more of SkyVerge's [free WooCommerce extensions](http://profiles.wordpress.org/skyverge/)
49 | - View all [SkyVerge WooCommerce extensions](http://www.skyverge.com/shop/)
50 | - View the FAQ for some tips.
51 |
52 | == Installation ==
53 |
54 | 1. Be sure you're running WooCommerce 3.5+ and WordPress 4.4+ in your shop.
55 | 2. Upload the entire `woocommerce-extra-product-sorting-options` folder to the `/wp-content/plugins/` directory, or upload the .zip file with the plugin under **Plugins > Add New > Upload**
56 | 3. Activate the plugin through the **Plugins** menu in WordPress
57 | 4. Go to **WooCommerce > Settings > Products > Display**. The new settings are added after "Default Product Sorting". If you enable more sorting options, you can set these as new defaults as well.
58 | 5. View [documentation on the product page](http://www.skyverge.com/product/woocommerce-extra-product-sorting-options/) for more help if needed.
59 |
60 | == Frequently Asked Questions ==
61 |
62 | = Do I need to rename the default sorting? =
63 | Nope. You can use this plugin to simply add new sorting options to your shop pages. Any of the settings are entirely optional.
64 |
65 | = How do I set my new sorting option as the default? =
66 | When you check to enable these options, save your Product settings. You'll now be able to select your new options as a default under the "Default Product Sorting" list.
67 |
68 | = Can I change the sorting label in the shop dropdown? =
69 | Yep! You can use the [Say What plugin](https://wordpress.org/plugins/say-what/) to change the text - for example, you could change the label that says "Sort by name: A to Z" to "Sort alphabetically". See the screenshots for an example.
70 |
71 | The text domain to use is `woocommerce-extra-product-sorting-options`.
72 |
73 | = Why doesn't sorting by availability work? =
74 | Don't worry, it does :) It's possible to sort by stock, but this will work for parent products rather than using the stock available at the variation level. You can set this under Product Data > Inventory by enabling "Manage stock". Set the available stock for _all_ variations, and this will be used to sort the item. You can still manage stock at the variation level.
75 |
76 | If you don't manage your stock, you should **disable** this option - it will simply work as an alphabetical sort if all products are just "In Stock" without inventory managed.
77 |
78 | = Why can't on-sale sorting work for variable products? =
79 | Simple products and variable products use two different "keys" to indicate if they're on sale. As a result, we can't order products using two different meta keys, so we've used the key that indicates a simple product's sale price in this plugin.
80 |
81 | We don't anticipate changing this in the foreseeable future, as we've spent a couple hours trying to get the custom search query to work, but WooCommerce core adds search parameters that conflict with it, and we haven't found a suitable work-around.
82 |
83 | = This is handy! Can I contribute? =
84 | Yes you can! Join in on our [GitHub repository](https://github.com/skyverge/woocommerce-extra-product-sorting-options/) and submit a pull request :)
85 |
86 | == Screenshots ==
87 | 1. Plugin Settings in the WooCommerce customizer panel
88 | 2. Some new sorting options on the shop page
89 | 3. Change sorting label (in shop dropdown) with the [Say What plugin](https://wordpress.org/plugins/say-what/)
90 |
91 | == Changelog ==
92 |
93 | = 2025.03.25 - version 2.11.0 =
94 | * Fix - "Show on sale first" should not exclude products lacking sale price meta
95 | * Misc - Add support for WooCommerce 9.7
96 |
97 | = 2023.07.28 - version 2.10.0 =
98 | * Misc - Add compatibility for WooCommerce High Performance Order Storage (HPOS)
99 | * Misc - Require PHP 7.4+, WordPress 5.6+ and WooCommerce 3.9+
100 |
101 | = 2022.07.31 - version 2.9.1 =
102 | * Misc - Rename to Extra Product Sorting Options for WooCommerce
103 |
104 | = 2021.04.27 - version 2.9.0 =
105 | * Feature - Allow users to remove core sorting options
106 | * Misc - Require WordPress 4.4+
107 | * Misc - Require WooCommerce 3.5+
108 | * Misc - Require PHP 5.6+
109 |
110 | = 2020.05.04 - version 2.8.4 =
111 | * Misc - Add support for WooCommerce 4.1
112 |
113 | = 2020.03.10 - version 2.8.3 =
114 | * Misc - Add support for WooCommerce 4.0
115 |
116 | = 2020.02.05 - version 2.8.2 =
117 | * Misc - Add support for WooCommerce 3.9
118 |
119 | = 2019.10.24 - version 2.8.1 =
120 | * Misc - Add support for WooCommerce 3.8
121 |
122 | = 2019.08.15 - version 2.8.0
123 | * Misc: Add support for WooCommerce 3.7
124 | * Misc: Remove support for WooCommerce 2.6
125 |
126 | = 2019.06.12 - version 2.7.4
127 | * Misc: Declare support for WooCommerce 3.6
128 |
129 | = 2018.10.30 - version 2.7.3 =
130 | * Fix: Respect product shortcode ordering on product pages
131 | * Misc: Add support for WooCommerce 3.5
132 |
133 | = 2018.08.10 - version 2.7.2 =
134 | * Localization - Bundled French translation, thanks Jérôme Wymann!
135 |
136 | = 2018.02.13 - version 2.7.1 =
137 | * Fix: PHP warnings for themes that don't support WooCommerce product column and row settings
138 |
139 | = 2018.02.08 - version 2.7.0 =
140 | * Tweak: Move settings to customizer panel in WooCommerce 3.3+
141 | * Fix: Ensure default sorting can be renamed if translated
142 | * Misc: Add support for WooCommerce 3.3
143 | * Misc: Require WooCommerce 2.6.14 and WordPress 4.4
144 |
145 | = 2017.08.22 - version 2.6.1 =
146 | * Fix: PHP warning when WooCommerce is outdated
147 |
148 | = 2017.03.23 - version 2.6.0 =
149 | * Feature: Sort products by review count
150 | * Misc: Removes 'featured first' sorting in shops running WooCommerce 3.0+ since featured meta is no longer available for products ([see notes](http://wordpress.org/plugins/woocommerce-extra-product-sorting-options/other_notes/) for further details)
151 | * Misc: Added support for WooCommerce 3.0
152 | * Misc: Removed support for WooCommerce 2.3.x
153 |
154 | = 2016.07.28 - version 2.5.0 =
155 | * Misc: removed 'randomized' sorting due to issues with larger catalogs ([see notes](http://wordpress.org/plugins/woocommerce-extra-product-sorting-options/other_notes/) for further details)
156 |
157 | = 2016.05.31 - version 2.4.0 =
158 | * Misc: added support for WooCommerce 2.6
159 | * Misc: removed support for WooCommerce 2.2
160 |
161 | = 2016.01.18 - version 2.3.0 =
162 | * Misc: updated textdomain to `woocommerce-extra-product-sorting-options` - **please update translations**!
163 | * Misc: WooCommerce 2.5 compatibility
164 |
165 | = 2015.09.07 - version 2.2.3 =
166 | * Fix: properly use `orderby` attributes when passed in via shortcode
167 |
168 | = 2015.08.17 - version 2.2.2 =
169 | * Misc: introduced `wc_extra_sorting_options_fallback_order` filter
170 | * Misc: pass in `$orderby_value` to `wc_extra_sorting_options_fallback` and `wc_extra_sorting_options_fallback_order` filters to let you change them for particular orderby
171 |
172 | = 2015.07.27 - version 2.2.1 =
173 | * Misc: WooCommerce 2.4 compatibility
174 |
175 | = 2015.07.13 - version 2.2.0 =
176 | * Feature: added title fallback to use as secondary sorting parameter
177 | * Misc: introduced `wc_extra_sorting_options_fallback` filter
178 | * Misc: dropped WooCommerce 2.1 support since 2.2 added orderby = rand support
179 |
180 | = 2015.02.06 - version 2.1.1 =
181 | * Fix: bug with loading translations
182 |
183 | = 2015.02.03 - version 2.1.0 =
184 | * Misc: WooCommerce 2.3 compatibility
185 |
186 | = 2015.01.09 - version 2.0.1 =
187 | * Fix: Squished a bug affecting random sorting
188 |
189 | = 2015.01.05 - version 2.0.0 =
190 | * Misc: Refactored to simplify code and add upgrade routine
191 | * Feature: Added "Featured" sorting
192 | * Feature: Added "Availability" sorting
193 | * Tweak: Changed settings to multi-select instead of checkbox group
194 | * Tweak: Text domain is now `wc-extra-sorting-options` instead of `woocommerce-extra-product-sorting-options`
195 |
196 | = 2014.07.30 - version 1.2.0 =
197 | * Feature: Added "On Sale" sorting (thanks [Bryce Adams](http://bryceadams.com/order-products-sale-woocommerce/) for the idea)
198 |
199 | = 2014.07.29 - version 1.1.0 =
200 | * Feature: Added reverse alphabetical sorting option
201 |
202 | = 2014.07.28 - version 1.0.0 =
203 | * Initial Release
204 |
--------------------------------------------------------------------------------
/sake.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | deploy: 'wp',
3 | framework: false,
4 | tasks: {
5 | makepot: {
6 | reportBugsTo: 'https://wordpress.org/support/plugin/woocommerce-extra-product-sorting-options'
7 | }
8 | },
9 | paths: {
10 | src: '.',
11 | exclude: [
12 | "build"
13 | ]
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tool.tartufo:
--------------------------------------------------------------------------------
1 | [tool.tartufo]
2 | exclude-paths="./exclude-patterns.txt"
3 | repo-path = "."
4 | default-regexes = true
5 | json = false
6 | regex = true
7 | entropy = true
8 | exclude-signatures = [
9 | "830b624bab8dc608815ee58190ca16dd21039ebdc6be7e1b3e0036e9573a12f9",
10 | ]
11 |
--------------------------------------------------------------------------------
/woocommerce-extra-product-sorting-options.php:
--------------------------------------------------------------------------------
1 | install();
89 | }
90 |
91 | // handle HPOS compatibility
92 | add_action( 'before_woocommerce_init', [ $this, 'handle_hpos_compatibility' ] );
93 | }
94 |
95 |
96 | /**
97 | * Declares HPOS compatibility.
98 | *
99 | * @since 2.10.0
100 | *
101 | * @internal
102 | *
103 | * @return void
104 | */
105 | public function handle_hpos_compatibility()
106 | {
107 | if ( class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
108 | \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', plugin_basename( __FILE__ ), true );
109 | }
110 | }
111 |
112 |
113 | /**
114 | * Adds Settings to WooCommerce Settings > Products page after "Default Product Sorting" setting.
115 | *
116 | * @internal
117 | *
118 | * @since 2.7.0
119 | *
120 | * @param \WP_Customize_Manager $wp_customize
121 | */
122 | public function add_customizer_settings( $wp_customize ) {
123 |
124 | // load our custom control type
125 | require_once __DIR__ . '/includes/class-wc-eso-customizer-checkbox-multiple.php';
126 |
127 | // make sure we can insert our desired controls where we want them {BR 2018-02-08}
128 | // this is heavy-handed, but WC core doesn't add priorities for us, shikata ga nai ¯\_(ツ)_/¯
129 | if ( $catalog_columns_control = $wp_customize->get_control( 'woocommerce_catalog_columns' ) ) {
130 | $catalog_columns_control->priority = 15;
131 | }
132 |
133 | if ( $catalog_rows_control = $wp_customize->get_control( 'woocommerce_catalog_rows' ) ) {
134 | $catalog_rows_control->priority = 15;
135 | }
136 |
137 | $wp_customize->add_setting(
138 | 'wc_rename_default_sorting',
139 | [
140 | 'default' => '',
141 | 'type' => 'option',
142 | 'capability' => 'manage_woocommerce',
143 | 'sanitize_callback' => 'sanitize_text_field',
144 | ]
145 | );
146 |
147 | $wp_customize->add_control(
148 | 'wc_rename_default_sorting',
149 | [
150 | 'label' => __( 'New Default Sorting Label', 'woocommerce-extra-product-sorting-options' ),
151 | 'description' => __( 'If desired, enter a new name for the default sorting option, e.g., "Our Sorting"', 'woocommerce-extra-product-sorting-options' ),
152 | 'section' => 'woocommerce_product_catalog',
153 | 'settings' => 'wc_rename_default_sorting',
154 | 'type' => 'text',
155 | 'priority' => 11,
156 | ]
157 | );
158 |
159 | $wp_customize->add_setting(
160 | 'wc_extra_product_sorting_options',
161 | [
162 | 'default' => [],
163 | 'capability' => 'manage_woocommerce',
164 | 'sanitize_callback' => [ $this, 'sanitize_option_list' ],
165 | ]
166 | );
167 |
168 | $wp_customize->add_control(
169 | new WC_ESO_Customize_Checkbox_Multiple(
170 | $wp_customize,
171 | 'wc_extra_product_sorting_options',
172 | [
173 | 'label' => __( 'Add Product Sorting:', 'woocommerce-extra-product-sorting-options' ),
174 | 'description' => sprintf(
175 | /* translators: Placeholders: %1$s - , %2$s - */
176 | __( 'Select sorting options to add to your shop. %1$ssee documentation%2$s for more details.', 'woocommerce-extra-product-sorting-options' ),
177 | '', ''
178 | ),
179 | 'type' => 'checkbox-multiple',
180 | 'section' => 'woocommerce_product_catalog',
181 | 'priority' => 11,
182 | 'choices' => $this->get_extra_sorting_setting_options(),
183 | ]
184 | )
185 | );
186 |
187 | $wp_customize->add_setting(
188 | 'wc_remove_product_sorting',
189 | [
190 | 'default' => [],
191 | 'capability' => 'manage_woocommerce',
192 | 'sanitize_callback' => [ $this, 'sanitize_option_list' ],
193 | ]
194 | );
195 |
196 | $wp_customize->add_control(
197 | new WC_ESO_Customize_Checkbox_Multiple(
198 | $wp_customize,
199 | 'wc_remove_product_sorting',
200 | [
201 | 'label' => __( 'Remove Product Sorting:', 'woocommerce-extra-product-sorting-options' ),
202 | 'description' => sprintf(
203 | /* translators: Placeholders: %1$s - , %2$s - */
204 | __( 'Select default sorting options to remove from your shop. %1$ssee documentation%2$s for more details.', 'woocommerce-extra-product-sorting-options' ),
205 | '', ''
206 | ),
207 | 'type' => 'checkbox-multiple',
208 | 'section' => 'woocommerce_product_catalog',
209 | 'priority' => 11,
210 | // ensures the options added by the other setting are not listed in this control
211 | 'choices' => array_diff_key( $this->get_core_sorting_setting_options( false ), $this->get_extra_sorting_setting_options() ),
212 | ]
213 | )
214 | );
215 | }
216 |
217 |
218 | /**
219 | * Sanitize the default sorting callback.
220 | *
221 | * @internal
222 | *
223 | * @since 2.7.0
224 | *
225 | * @param string|string[] $values the option value
226 | * @return string[]
227 | */
228 | public function sanitize_option_list( $values ) {
229 |
230 | $multi_values = ! is_array( $values ) ? explode( ',', $values ) : $values;
231 |
232 | return ! empty( $multi_values ) ? array_map( 'sanitize_text_field', $multi_values ) : [];
233 | }
234 |
235 |
236 | /**
237 | * Gets sorting options as settings options.
238 | *
239 | * @since 2.7.0
240 | *
241 | * @return array settings options
242 | */
243 | private function get_extra_sorting_setting_options() {
244 |
245 | return [
246 | 'alphabetical' => __( 'Name: A to Z', 'woocommerce-extra-product-sorting-options' ),
247 | 'reverse_alpha' => __( 'Name: Z to A', 'woocommerce-extra-product-sorting-options' ),
248 | 'by_stock' => __( 'Available Stock', 'woocommerce-extra-product-sorting-options' ),
249 | 'review_count' => __( 'Review Count', 'woocommerce-extra-product-sorting-options' ),
250 | 'on_sale_first' => __( 'On-sale First', 'woocommerce-extra-product-sorting-options' ),
251 | ];
252 | }
253 |
254 |
255 | /**
256 | * Gets WooCommerce default sorting options as settings options.
257 | *
258 | * WooCommerce doesn't store these into an option, and rather hardcodes them wrapped in a filter.
259 | *
260 | * @since 2.9.0
261 | *
262 | * @param bool $filter_output whether to filter the output through the WooCommerce core filter (default true)
263 | * @return array
264 | */
265 | private function get_core_sorting_setting_options( $filter_output = true ) {
266 |
267 | // WooCommerce textdomain used intentionally
268 | $options = [
269 | 'menu_order' => __( 'Default sorting', 'woocommerce' ),
270 | 'popularity' => __( 'Sort by popularity', 'woocommerce' ),
271 | 'rating' => __( 'Sort by average rating', 'woocommerce' ),
272 | 'date' => __( 'Sort by latest', 'woocommerce' ),
273 | 'price' => __( 'Sort by price: low to high', 'woocommerce' ),
274 | 'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ),
275 | ];
276 |
277 | /* WooCommerce core filter documented in wc-template-functions.php */
278 | return ! $filter_output ? $options : (array) apply_filters( 'woocommerce_catalog_orderby', $options );
279 | }
280 |
281 |
282 | /**
283 | * Gets the number of available sorting options.
284 | *
285 | * @since 2.9.0
286 | *
287 | * @return int
288 | */
289 | private function get_available_sorting_options_count() {
290 |
291 | return count( $this->get_available_sorting_options() );
292 | }
293 |
294 |
295 | /**
296 | * Gets the available sorting options.
297 | *
298 | * @since 2.9.0
299 | *
300 | * @return array
301 | */
302 | private function get_available_sorting_options() {
303 |
304 | // sums up all the default and extra sorting options, minus the default ones removed, if any
305 | return array_unique( array_filter( array_diff(
306 | array_merge(
307 | array_keys( $this->get_core_sorting_setting_options() ),
308 | (array) get_theme_mod( 'wc_extra_product_sorting_options', [] )
309 | ),
310 | (array) get_theme_mod( 'wc_remove_product_sorting', [] )
311 | ) ) );
312 | }
313 |
314 |
315 | /**
316 | * Modifies WooCommerce sorting settings.
317 | *
318 | * - Changes "Default Sorting" to the custom name and adds new sorting options
319 | * - Adds any extra sorting options
320 | * - Removes any default sorting options
321 | *
322 | * Effective in both admin and frontend options.
323 | *
324 | * @internal
325 | *
326 | * @since 2.0.0
327 | *
328 | * @param array $order_by associative array of sorting option keys and names
329 | * @return array
330 | */
331 | public function modify_sorting_settings( $order_by ) {
332 |
333 | // maybe rename the "default sorting" label
334 | $new_default_name = get_option( 'wc_rename_default_sorting', '' );
335 |
336 | if ( ! empty( $new_default_name ) && ( $default_option = get_option( 'woocommerce_default_catalog_orderby', 'menu_order' ) ) ) {
337 | $order_by[ $default_option ] = $new_default_name;
338 | }
339 |
340 | // add any extra sorting options
341 | $new_sorting_options = get_theme_mod( 'wc_extra_product_sorting_options', [] );
342 |
343 | foreach( $new_sorting_options as $option ) {
344 |
345 | switch ( $option ) {
346 | case 'alphabetical':
347 | $order_by['alphabetical'] = __( 'Sort by name: A to Z', 'woocommerce-extra-product-sorting-options' );
348 | break;
349 | case 'reverse_alpha':
350 | $order_by['reverse_alpha'] = __( 'Sort by name: Z to A', 'woocommerce-extra-product-sorting-options' );
351 | break;
352 | case 'by_stock':
353 | $order_by['by_stock'] = __( 'Sort by availability', 'woocommerce-extra-product-sorting-options' );
354 | break;
355 | case 'review_count':
356 | $order_by['review_count'] = __( 'Sort by review count', 'woocommerce-extra-product-sorting-options' );
357 | break;
358 | case 'on_sale_first':
359 | $order_by['on_sale_first'] = __( 'Show sale items first', 'woocommerce-extra-product-sorting-options' );
360 | break;
361 | }
362 | }
363 |
364 | // remove any default sorting options
365 | foreach ( (array) get_theme_mod( 'wc_remove_product_sorting', [] ) as $removed_option ) {
366 | unset( $order_by[ $removed_option ] );
367 | }
368 |
369 | return $order_by;
370 | }
371 |
372 |
373 | /**
374 | * Adds sorting option to WooCommerce sorting arguments.
375 | *
376 | * @internal
377 | *
378 | * @since 2.0.0
379 | *
380 | * @param array $sort_args the sorting arguments and query to use for it
381 | * @return array updated sorting arguments
382 | */
383 | public function add_new_shop_ordering_args( $sort_args ) {
384 |
385 | $orderby_value = $this->getOrderByFromRequest();
386 |
387 | // Since a shortcode can be used on a non-WC page, we won't have $_GET['orderby'].
388 | // Grab it from the passed in sorting args instead for non-WC pages.
389 | // Don't use this on WC archives so we don't break the default option.
390 | if ( isset( $sort_args['orderby'] ) && ! is_post_type_archive( 'product' ) && ! is_shop() ) {
391 | $orderby_value = $sort_args['orderby'];
392 | }
393 |
394 | /**
395 | * Filters the extra sorting option fallback.
396 | *
397 | * @since 1.0.0
398 | *
399 | * @param string $fallback defaults to 'title'
400 | * @param string $orderby_value
401 | */
402 | $fallback = (string) apply_filters( 'wc_extra_sorting_options_fallback', 'title', $orderby_value );
403 |
404 | /**
405 | * Filters the extra sorting option order.
406 | *
407 | * @since 1.0.0
408 | *
409 | * @param string $fallback_order defaults to 'ASC' (ascending)
410 | * @param string $orderby_value
411 | */
412 | $fallback_order = (string) apply_filters( 'wc_extra_sorting_options_fallback_order', 'ASC', $orderby_value );
413 |
414 | switch( $orderby_value ) {
415 |
416 | case 'alphabetical':
417 |
418 | $sort_args['orderby'] = 'title';
419 | $sort_args['order'] = 'asc';
420 |
421 | break;
422 |
423 | case 'reverse_alpha':
424 |
425 | $sort_args['orderby'] = 'title';
426 | $sort_args['order'] = 'desc';
427 | $sort_args['meta_key'] = '';
428 |
429 | break;
430 |
431 | case 'by_stock':
432 |
433 | $sort_args['orderby'] = [ 'meta_value_num' => 'DESC', $fallback => $fallback_order ];
434 | $sort_args['meta_key'] = '_stock';
435 |
436 | break;
437 |
438 | case 'review_count':
439 |
440 | $sort_args['orderby'] = [ 'meta_value_num' => 'DESC', $fallback => $fallback_order ];
441 | $sort_args['meta_key'] = '_wc_review_count';
442 |
443 | break;
444 |
445 | case 'on_sale_first':
446 | // 'meta_key' for this orderby value is handled separately via 'meta_query'
447 | // arguments set in the addOnSaleOrderingArgs() callback.
448 | $sort_args['orderby'] = [ 'meta_value' => 'DESC', $fallback => $fallback_order ];
449 |
450 | // on sale ordering meta query
451 | add_filter('woocommerce_product_query_meta_query', [$this, 'addOnSaleOrderingArgs']);
452 |
453 | break;
454 | }
455 |
456 | return $sort_args;
457 | }
458 |
459 |
460 | /**
461 | * Adds meta query arguments to allow sorting by "On Sale" first.
462 | *
463 | * The 'on_sale_first' orderby is handled as a meta query to allow for querying
464 | * products entirely lacking the '_sale_price' meta.
465 | *
466 | * @param array $metaQuery
467 | * @return array
468 | */
469 | public function addOnSaleOrderingArgs($metaQuery) {
470 |
471 | return $metaQuery[] = [
472 | 'relation' => 'OR',
473 | [
474 | 'key' => '_sale_price',
475 | 'compare' => 'NOT EXISTS',
476 | ],
477 | [
478 | 'relation' => 'OR',
479 | [
480 | 'key' => '_sale_price',
481 | 'value' => 0,
482 | 'compare' => '>=',
483 | 'type' => 'numeric',
484 | ],
485 | [
486 | 'key' => '_sale_price',
487 | 'value' => '',
488 | 'compare' => '=',
489 | ],
490 | ],
491 | ];
492 | }
493 |
494 |
495 | /**
496 | * Gets the orderby value from the current request.
497 | *
498 | * @return string
499 | */
500 | private function getOrderByFromRequest() : string
501 | {
502 |
503 | // If we have the orderby via URL, let's pass it in.
504 | // This means we're on a shop / archive, so if we don't have it, use the default.
505 | if ( isset( $_GET['orderby'] ) ) {
506 | $orderby_value = wc_clean( $_GET['orderby'] );
507 | } else {
508 | /* WooCommerce core filter defined in wc-template-functions.php */
509 | $orderby_value = (string) apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', 'menu_order' ) );
510 | }
511 |
512 | return $orderby_value;
513 | }
514 |
515 |
516 | /**
517 | * Changes the default sorting if there is only one sorting option available.
518 | *
519 | * @since 2.9.0
520 | *
521 | * @internal
522 | *
523 | * @param string $default_orderby
524 | * @return string
525 | */
526 | public function maybe_update_default_catalog_orderby( $default_orderby ) {
527 |
528 | if ( 1 === $this->get_available_sorting_options_count() ) {
529 | $default_orderby = (string) current($this->get_available_sorting_options());
530 | }
531 |
532 | return $default_orderby;
533 | }
534 |
535 |
536 | /**
537 | * Unhooks the sorting dropdown if all options have been removed.
538 | *
539 | * @internal
540 | *
541 | * @since 2.9.0
542 | */
543 | public function maybe_remove_catalog_orderby() {
544 |
545 | /**
546 | * Filters whether the sorting dropdown should be unhooked from the shop page when there are no core sorting options.
547 | *
548 | * Inherited from WooCommerce Remove Product Sorting Options legacy plugin.
549 | *
550 | * @since 2.9.0
551 | *
552 | * @param bool $remove true if the dropdown should be removed
553 | */
554 | if ( (bool) apply_filters( 'wc_remove_sorting_options_hide_dropdown', $this->get_available_sorting_options_count() <= 1 ) ) {
555 |
556 | // WooCommerce core output
557 | remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
558 |
559 | // Storefront theme
560 | remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
561 | remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
562 | }
563 | }
564 |
565 |
566 | /**
567 | * Gets the plugin instance (singleton pattern).
568 | *
569 | * @see wc_extra_sorting_options()
570 | *
571 | * @since 2.2.2
572 | *
573 | * @return \WC_Extra_Sorting_Options
574 | */
575 | public static function instance() {
576 |
577 | if ( null === self::$instance ) {
578 | self::$instance = new self();
579 | }
580 |
581 | return self::$instance;
582 | }
583 |
584 |
585 | /**
586 | * Cloning instances is forbidden due to singleton pattern.
587 | *
588 | * @since 2.4.0
589 | */
590 | public function __clone() {
591 | /* translators: Placeholders: %s - plugin name */
592 | _doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'You cannot clone instances of %s.', 'woocommerce-extra-product-sorting-options' ), 'Extra Product Sorting Options for WooCommerce' ), '2.4.0' );
593 | }
594 |
595 |
596 | /**
597 | * Unserializing instances is forbidden due to singleton pattern.
598 | *
599 | * @since 2.4.0
600 | */
601 | public function __wakeup() {
602 | /* translators: Placeholders: %s - plugin name */
603 | _doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'You cannot unserialize instances of %s.', 'woocommerce-extra-product-sorting-options' ), 'Extra Product Sorting Options for WooCommerce' ), '2.4.0' );
604 | }
605 |
606 |
607 | /**
608 | * Adds plugin page links.
609 | *
610 | * @internal
611 | *
612 | * @since 2.2.2
613 | *
614 | * @param array $links all plugin links
615 | * @return array $links all plugin links + our custom links (i.e., "Settings")
616 | */
617 | public function add_plugin_links( $links ) {
618 |
619 | $configure_url = admin_url( 'customize.php?url=' . wc_get_page_permalink( 'shop' ) . '&autofocus[section]=woocommerce_product_catalog' );
620 | $plugin_links = [
621 | '' . __( 'Configure', 'woocommerce-extra-product-sorting-options' ) . '',
622 | ''. __( 'FAQ', 'woocommerce-extra-product-sorting-options' ) . '',
623 | '' . __( 'Support', 'woocommerce-extra-product-sorting-options' ) . '',
624 | ];
625 |
626 | return array_merge( $plugin_links, $links );
627 | }
628 |
629 |
630 | /**
631 | * Loads translations.
632 | *
633 | * @internal
634 | *
635 | * @since 2.1.1
636 | */
637 | public function load_translation() {
638 |
639 | load_plugin_textdomain( 'woocommerce-extra-product-sorting-options', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/languages' );
640 | }
641 |
642 |
643 | /**
644 | * Determines whether a plugin is active.
645 | *
646 | * @since 2.7.2
647 | *
648 | * @param string $plugin_name plugin name, as the plugin-filename.php
649 | * @return bool
650 | */
651 | public static function is_plugin_active( $plugin_name ) {
652 |
653 | $active_plugins = (array) get_option( 'active_plugins', [] );
654 |
655 | if ( is_multisite() ) {
656 | $active_plugins = array_merge( $active_plugins, array_keys( get_site_option( 'active_sitewide_plugins', [] ) ) );
657 | }
658 |
659 | $plugin_filenames = [];
660 |
661 | foreach ( $active_plugins as $plugin ) {
662 |
663 | if ( false !== strpos( $plugin, '/' ) ) {
664 |
665 | // normal plugin name (plugin-dir/plugin-filename.php)
666 | list( , $filename ) = explode( '/', $plugin );
667 |
668 | } else {
669 |
670 | // no directory, just plugin file
671 | $filename = $plugin;
672 | }
673 |
674 | $plugin_filenames[] = $filename;
675 | }
676 |
677 | return in_array( $plugin_name, $plugin_filenames, false );
678 | }
679 |
680 |
681 | /**
682 | * Renders a notice when WooCommerce version is outdated.
683 | *
684 | * @internal
685 | *
686 | * @since 2.4.0
687 | */
688 | public static function render_outdated_wc_version_notice() {
689 |
690 | ?>
691 |
692 |
693 | , %2$s - , %3$s - version number, %4$s - opening HTML link tag, %5$s - closing HTML link tag, %6$s - opening HTML link tag, %7$s - closing HTML link tag */
695 | esc_html__( '%1$sExtra Product Sorting Options for WooCommerce is inactive.%2$s This plugin requires WooCommerce %3$s or newer. Please %4$supdate WooCommerce%5$s or %6$srun the WooCommerce database upgrade%7$s.', 'woocommerce-extra-product-sorting-options' ),
696 | '', '',
697 | self::MIN_WOOCOMMERCE_VERSION,
698 | '', '',
699 | '', ''
700 | ); ?>
701 |
702 |
703 | =' );
718 | }
719 |
720 |
721 | /**
722 | * Checks if WooCommerce is less than than a specific version.
723 | *
724 | * @since 2.7.0
725 | *
726 | * @param string $version version number
727 | * @return bool
728 | */
729 | public static function is_wc_lt( $version ) {
730 |
731 | return defined( 'WC_VERSION' ) && WC_VERSION && version_compare( WC_VERSION, $version, '<' );
732 | }
733 |
734 |
735 | /**
736 | * Gets the plugin URL.
737 | *
738 | * @since 2.7.0
739 | *
740 | * @return string the plugin URL
741 | */
742 | public function get_plugin_url() {
743 |
744 | return untrailingslashit( plugins_url( '/', __FILE__ ) );
745 | }
746 |
747 |
748 | /**
749 | * Performs lifecycle routines.
750 | *
751 | * Runs every time, since the activation hook is not executed when updating a plugin.
752 | *
753 | * @since 2.0.0
754 | */
755 | private function install() {
756 |
757 | // get current version to check for upgrade
758 | $installed_version = get_option( 'wc_extra_sorting_options_version' );
759 |
760 | // force upgrade to 2.0.0, prior versions did not have version option set
761 | if ( ! $installed_version && ! get_option( 'wc_extra_product_sorting_options' ) ) {
762 | $this->upgrade( '1.2.0' );
763 | }
764 |
765 | // upgrade if installed version lower than plugin version
766 | if ( -1 === version_compare( $installed_version, self::VERSION ) ) {
767 | $this->upgrade( $installed_version );
768 | }
769 | }
770 |
771 |
772 | /**
773 | * Performs any version-related changes.
774 | *
775 | * @since 2.0.0
776 | *
777 | * @param int $installed_version the currently installed version of the plugin
778 | */
779 | private function upgrade( $installed_version ) {
780 |
781 | // upgrade from 1.2.0 to 2.0.0
782 | if ( '1.2.0' === $installed_version ) {
783 |
784 | $new_options = [];
785 | $old_options = [
786 | 'wc_alphabetical_product_sorting' => 'alphabetical',
787 | 'wc_reverse_alphabetical_product_sorting' => 'reverse_alpha',
788 | 'wc_on_sale_product_sorting' => 'on_sale_first',
789 | 'wc_random_product_sorting' => 'randomize',
790 | ];
791 |
792 | foreach ( $old_options as $old_key => $new_key ) {
793 | if ( 'yes' === get_option( $old_key ) ) {
794 | $new_options[] = $new_key;
795 | }
796 | }
797 |
798 | update_option( 'wc_extra_product_sorting_options', $new_options );
799 | }
800 |
801 | // remove random sorting if it was set
802 | if ( version_compare( $installed_version, '2.5.0', '<' ) ) {
803 |
804 | $settings = get_option( 'wc_extra_product_sorting_options' );
805 |
806 | if ( in_array( 'randomize', $settings, true ) ) {
807 |
808 | unset( $settings[ array_search('randomize', $settings, true ) ] );
809 |
810 | update_option( 'wc_extra_product_sorting_options', $settings );
811 |
812 | add_action( 'admin_notices', [ $this, 'render_2_5_upgrade_notice' ] );
813 | }
814 | }
815 |
816 | if ( version_compare( $installed_version, '2.6.0', '<' ) ) {
817 |
818 | $settings = get_option( 'wc_extra_product_sorting_options' );
819 |
820 | // let people know the settings will change / have changed in WC 3.0+
821 | if ( in_array( 'featured_first', $settings, true ) ) {
822 | add_action( 'admin_notices', [ $this, 'render_wc_30_update_notice' ] );
823 | }
824 | }
825 |
826 | // copy enabled sorting settings to theme mods for WC 3.3+ usage
827 | if ( version_compare( $installed_version, '2.6.2', '<' ) ) {
828 | set_theme_mod( 'wc_extra_product_sorting_options', get_option( 'wc_extra_product_sorting_options', [] ) );
829 | }
830 |
831 | // add the setting option for removing default sorting options unless migrated from legacy free plugin
832 | if ( version_compare( $installed_version, '2.9.0', '<' ) && ! get_theme_mod( 'wc_remove_product_sorting' ) ) {
833 | set_theme_mod( 'wc_remove_product_sorting', [] );
834 | }
835 |
836 | // removes Remove Product Sorting legacy plugin, if found
837 | add_action( 'admin_init', [ $this, 'remove_legacy_plugin' ] );
838 |
839 | // update the installed version option
840 | update_option( 'wc_extra_sorting_options_version', self::VERSION );
841 | }
842 |
843 |
844 | /**
845 | * Removes WooCommerce Product Sorting.
846 | *
847 | * The legacy plugin has been merged into Extra Sorting Option so it's no longer necessary.
848 | *
849 | * @internal
850 | *
851 | * @since 2.9.0
852 | */
853 | public function remove_legacy_plugin() {
854 |
855 | $legacy_plugin = 'woocommerce-remove-product-sorting/woocommerce-remove-product-sorting.php';
856 |
857 | if ( in_array( $legacy_plugin, (array) get_option( 'active_plugins', [] ), true ) ) {
858 | deactivate_plugins( $legacy_plugin, true );
859 | }
860 |
861 | delete_plugins( [ $legacy_plugin ] );
862 | }
863 |
864 |
865 | /**
866 | * Renders a notice when upgrading to v2.5 if random sorting was enabled, as this was removed from the plugin.
867 | *
868 | * @internal
869 | *
870 | * @since 2.5.0
871 | */
872 | public function render_2_5_upgrade_notice() {
873 |
874 | ?>
875 |
876 |
877 | , %2$s - , %3$s - , %4$s - */
879 | esc_html__( '%1$sExtra Product Sorting Options for WooCommerce settings have changed.%2$s Random sorting is now disabled. If you need to re-add this option, please %3$sview our plugin notes%4$s.', 'woocommerce-extra-product-sorting-options' ),
880 | '', '',
881 | '', ' »'
882 | ); ?>
883 |
884 |
885 |
899 |
900 |
901 | , %2$s - , %3$s - , %4$s - */
903 | esc_html__( '%1$sExtra Product Sorting Options for WooCommerce settings have changed.%2$s Featured sorting is no longer possible with WooCommerce 3.0+ as this product data has changed. Please %3$sview our plugin notes%4$s for more details.', 'woocommerce-extra-product-sorting-options' ),
904 | '',
905 | '',
906 | '',
907 | ' »'
908 | ); ?>
909 |