Commit Graph

687 Commits

Author SHA1 Message Date
Martin Adamko c2ab6a488d
Encapsulate scope of `c` variable
By changing to auto invoking call the `c` variable will be encapsulated in its scope therefore not polluting the global scope and will continue to function as previously.

Fixes conflict and reassigning of already used variables when using other minified scripts. In my case the problem occurred with the Speed Booster Pack plugin.
2020-09-08 09:20:18 +02:00
Ron Rennick 51afe3207a
Merge pull request #27023 from HikeMike/add/hidden-form-field
"Hidden" field type added to woocommerce_form_field() #26468
2020-08-20 11:48:26 -03:00
Nestor Soriano 2283a4c7fd Revert woocommerce_product_loop to use have_posts instead of wc_get_loop_prop( 'total' ). 2020-07-28 09:01:55 +02:00
Néstor Soriano e9d692f455 Apply suggestions from code review
Mostly adding "since 4.4.0" annotations and updating
db update functions from 4.2 to 4.4.

Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-07-28 09:01:55 +02:00
Nestor Soriano 50e8f27bc7 Fix visibility of variable products with layered nav filtering.
The layered nav filtering doesn't work well with variable products
when some variations have stock and other don't. When a term is
selected in the widget, a variable product having no stock for
the variation corresponding to that term but having stock for
other variations will be displayed, but it shouldn't.

This commit fixes that by introducing two changes:

- A new override of "is_visible" for WC_Product_Variable that
  looks at the supplied filters, compares them against the corresponding
  available variations and calculates the visibility based on
  the query type (OR or AND).

- A hook on the "found_posts" filter in WC_Query, that adjusts
  the posts count based on the found products visibility
  when there are filters available; this is needed to sync the
  "displaying X posts" messages and the paging when variable
  products are hidden due to stock status.

Additionally, the visibility calculated in "found_posts" is cached
as loop variables so that it isn't calculated again when actually
displaying the products.
2020-07-28 08:55:52 +02:00
Nestor Soriano c27283dffe Fix code sniffer errors in some files.
Fixed files:

includes/abstracts/abstract-wc-product.php
includes/class-wc-query.php
includes/wc-template-functions.php
includes/widgets/class-wc-widget-layered-nav.php
templates/loop/result-count.php
tests/unit-tests/util/class-wc-tests-wc-query.php
2020-07-28 08:47:29 +02:00
Mike Dent 541f68363e Test code updated, with thanks to @ObliviousHarmony 2020-07-20 15:45:13 +01:00
Mike Dent 53d9085c16 Fixed indent and incomplete test code. 2020-07-12 19:26:57 +01:00
Mike Dent cf9db99a9f "Hidden" field type added to woocommerce_form_field() #26468 2020-07-12 16:38:36 +01:00
Néstor Soriano 3a77066262
Merge pull request #26554 from jeffreyscottfrench/Fix--select_country-default-value
Sets "Select a country / region..." option element's value attribute to default in checkout page.
2020-06-30 10:34:06 +02:00
Peter Fabian 14a26aca2c Update min files and selectWoo 2020-06-16 17:15:12 +02:00
Dor Elidan 4b6e56b02a
Update wc-template-functions.php 2020-06-05 18:22:34 +03:00
Gregory Karpinsky 3d02da9a03
Update wc-template-functions.php
Fix variable name in docblock
2020-05-31 08:43:44 -04:00
Jeffrey Scott French 9faee1d909 Sets Select a country option element value attribute to default. 2020-05-19 15:07:27 -04:00
Philipp Bammes 0097beef17
Fix typo in DocBlock of `woocommerce_template_loop_product_link_close()`
Replace `opening` with `closing`.
2020-02-07 16:51:12 +01:00
Christopher Allford 57734ca8ce Merge branch 'master' into refactor/add-jetpack-constants 2020-02-04 14:36:35 -08:00
Christopher Allford 4ae1e1f5fc Extracted the repetitive Constants::get_constant( 'WC_VERSION' ) calls where possible 2020-02-04 14:02:57 -08:00
Claudio Sanches e0ee96cd37
Merge pull request #25418 from helgatheviking/feature/quantity-placeholders
Add support for placeholders in quantity inputs
2020-02-04 14:05:39 -03:00
Christopher Allford 1d1413b4ee Replaced direct access of many constants with the Constants library 2020-01-31 22:18:47 -08:00
Peter Fabian 7c07b192af Changed country to country/region label. 2020-01-30 12:42:41 +01:00
Kathy Daring 917795d78f Add woocommerce_quantity_input_placeholder filter 2020-01-20 10:27:45 -07:00
Kathy Daring bcb17b62c2 Add support for placeholders in quantity inputs
(cherry picked from commit 99eb5074f3)
2020-01-16 12:47:15 -07:00
Rodrigo Primo 2c74233be2 Fix WordPress.WhiteSpace.DisallowInlineTabs violations
This commit fixes all violations of the WordPress.WhiteSpace.DisallowInlineTabs sniff automatically using phpcbf.
2019-12-20 14:27:07 -03:00
Claudio Sanches 4ea81923da
Merge pull request #24935 from woocommerce/fix/24845-wpcom-customizer
Do not run send_frame_options_header when on the customizer
2019-12-05 20:28:55 -03:00
Claudio Sanches 0686e6f1cd
Merge pull request #25000 from woocommerce/feature/pay-button-support
Initial support for "pay button"
2019-12-04 16:02:02 -03:00
itzmekhokan 0716648c28 woocommerce_upsells_display order filter added 2019-11-11 22:35:32 +05:30
Claudio Sanches fdd391e10e Introduced wc_get_pay_buttons() function 2019-11-07 17:23:38 -03:00
Gerhard 0cda53580f Do not run send_frame_options_header when on the customizer 2019-10-30 15:37:04 +02:00
Vedanshu Jain cb12010627
Merge pull request #24295 from woocommerce/fix/24096
Remove %20 from fields in External Products form
2019-10-03 00:15:52 +05:30
Claudio Sanches 830553accd Fixed coding standards 2019-10-02 11:21:19 -03:00
Marco Almeida 1df96da7f8
Replace wc_get_page_permalink( 'cart' ) with wc_get_cart_url() 2019-08-29 08:49:11 +01:00
Yash Kapoor e4456144f9
Update wc-template-functions.php 2019-08-22 12:35:38 +05:30
Yash Kapoor bd6c7cfb13
Update wc-template-functions.php
Fixed spelling of woocommerce_gallery_thumbnail_size
2019-08-22 12:10:54 +05:30
Claudio Sanches 843df9c8b9 Remove %20 from strings when building a form from query strings 2019-08-01 17:24:32 -03:00
Claudio Sanches 52ba85c977 Introduced filter to change default redirect url in wc_logout_url() 2019-07-31 20:35:10 -03:00
Jaden 83a3c2362a
Fix Missing Translation for Subtotal 2019-07-19 12:53:59 +00:00
Gerhard 6e4e818170 Introduce woocommerce_widget_shopping_cart_subtotal function and move minicart template subtotal to use it. New woocommerce_before_cart_collaterals, woocommerce_widget_shopping_cart_total and woocommerce_widget_shopping_cart_after_buttons actions for making the cart and mini cart templates more flexible without having to override it. 2019-07-14 19:27:42 +02:00
Gerhard Potgieter 9ca6dad11e
Merge pull request #23433 from justlevine/master
Preserve State field input classes when selecting a Country.
2019-07-10 15:31:39 +02:00
justlevine efb8b9af57
Added missing quote
Quote missing between `placeholder` and `data-input-classes` attributes.
2019-06-11 20:47:22 +03:00
Claudio Sanches c96ed877af
Merge pull request #23660 from gocodebox/master
add filter to allow disabling endpoint 404 behavior, per #23622
2019-05-10 12:50:29 -03:00
Thomas Patrick Levy 4e58b098e5 update filter 2019-05-09 15:49:03 -07:00
Thomas Patrick Levy 57bbcf94b7 add filter to allow disabling endpoint 404 behavior, per #23622 2019-05-08 17:35:28 -07:00
Rodrigo Primo 45c2c78ea2 Fix: parameter values should be converted back as well when building form fields
PR #23196 added a workaround to `parse_str()` limitation when dealing with full-stops, pluses, and spaces in the parameter key. This workaround involved temporarily replacing those three characters with placeholders before calling `parse_str()` and then replacing back to the original form. This commit fixes a bug in this logic that was replacing back only parameters keys and not parameters values.

For example, if the query string is `?query.parameter=foo.bar`, the resulting <input> field contained `foo{dot}bar`, instead of the expected `foo.bar`.
2019-04-26 13:58:27 -03:00
Mike Jolley 192fecc0d8 Remove filter only needs priority
Co-Authored-By: Dragoș Mocrii <dragosmocrii@users.noreply.github.com>
2019-04-24 13:54:12 +01:00
Mike Jolley 04e51191c4 Pass $class 2019-04-23 18:06:09 +01:00
Mike Jolley 246596dec0 Put the post_class back to avoid breaking bw compat. Append core classes on top 2019-04-23 18:04:20 +01:00
Dovid Levine 3ad9fb32be Add data-input-classes to state field 2019-04-22 19:18:48 +03:00
Mike Jolley 662af85bea cleanup and docs 2019-04-18 19:33:48 +01:00
Mike Jolley 7737fc5928 remove post_class and implement woocommerce_post_class 2019-04-18 19:27:00 +01:00
Mike Jolley fbaaa319dd Use global product if null 2019-04-18 17:25:13 +01:00