Commit Graph

271 Commits

Author SHA1 Message Date
Mike Jolley 47a5c39ea1 deprecate wc_get_min_max_price_meta_query 2019-02-11 15:45:09 +00:00
Mike Jolley 5429770992 Sample update function and price sorting 2019-02-11 14:42:11 +00:00
Mike Jolley 00b48febac Merge branch 'update/versioned-transients-alt' 2019-02-06 13:18:50 +00:00
Mike Jolley ec7db6de06 Simplify check 2019-02-06 12:46:36 +00:00
Mike Jolley cb4bf5d1e5 Fix unit tests 2019-02-06 12:44:24 +00:00
Mike Jolley 4635ccc04f Check we have a valid attachment 2019-02-05 14:11:16 +00:00
Mike Jolley 24bc59a025
Merge pull request #22443 from woocommerce/fix/21705
Placeholder resizing improvements
2019-02-04 11:13:49 +00:00
Mike Jolley 7cd20021e0 Sort terms by parent and work back from bottommost term
Fixes the issue described in #21299 by sorting terms by parent ID.

Remove the extra get_term call because we already have a term object.

Since we support 4.7+, also removed function exists for wp_list_sort function.
2019-01-22 19:06:58 +00:00
Mike Jolley d3ac50d47f Remove heavy queries from transient cleanup function
Remove heavy queries from transient cleanup function

Removes unneccessary loops and heavy queries.

There is a parent update and cache clear which was added in #17141. This cleanup is handled in `update_attributes` so doing it again here should be unneccessary.

Finally, the layered nav cleanup here can be moved. #22029 notes that this was needed in case of a stock change affecting product visibility. If we move to the data store, we can avoid getting the product here which is slower.
2019-01-21 13:02:31 +00:00
Mike Jolley c5da2dbcde Remove unrelated transient
wc_count_comments is completely unrelated to products. This can be moved to the transient cleanup tool, because code already exists to clear this cache when needed in WC_Comments.
2019-01-21 12:59:39 +00:00
Claudiu Lodromanean 989865469e
Merge pull request #22416 from woocommerce/fix/21871
Incorrect rounding of multiple tax rates per location
2019-01-16 09:32:51 -08:00
Rodrigo Primo 507f67cb38
Merge pull request #22029 from woocommerce/fix/21429
FIx:  Delete wc_layered_nav_counts_* transients whenever a product is updated
2019-01-14 15:26:15 -02:00
Mike Jolley 696d042c0e
Merge pull request #22255 from aelia-co/Tweak-wc_get_min_max_price_meta_query-filter
Added new filter "woocommerce_get_min_max_price_meta_query"
2019-01-14 17:04:59 +00:00
Mike Jolley 1e563aea29 Use wp_get_attachment_image if we have an attachment based placeholder 2019-01-14 13:55:12 +00:00
Mike Jolley 549a0f01c0 Placeholders need srcset and sizes 2019-01-14 12:54:54 +00:00
Mike Jolley 14b0e87301 Fixes edge case due to orders screen expecting unrounded values. 2019-01-11 14:07:41 +00:00
Mike Jolley 96603720ca Item subtotal rounding must match cart calc class
Fixes #21871
2019-01-11 11:41:22 +00:00
Rodrigo Primo 941217719e phpcs fixes using phpcbf 2018-12-19 13:31:11 -02:00
Diego 5970c9d0f5 Added new filter "woocommerce_get_min_max_price_meta_query" 2018-12-17 22:42:35 +00:00
Rodrigo Primo a9994feeea Delete wc_layered_nav_counts_* transients whenever a product is updated
This commit moves the code to delete wc_layered_nav_counts_* transients from WC_Product_Data_Store_CPT::update_attributes() to wc_delete_product_transients(). This way those transients will be deleted whenever a product is updated and not only when the product attributes are updated. This is needed to make sure that the "Filter Products by Attribute" displays the correct list of attributes when a product changes from out of stock to in stock or vice versa via the "Quick Edit" interface or the WC API.
2018-11-23 15:30:38 -02:00
Rodrigo Primo eb76ac9f65 Fix phpcs violations automatically using phpcbf 2018-11-23 12:37:23 -02:00
claudiulodro 255877211a Dont default to gallery thumbnail size if flexslider disabled 2018-10-24 11:07:43 -07:00
pierrebuet db3270a390 Show the right size of placeholder image on single product page
in the template for the product image, wc_placeholder_img_src() returns the thumbnail size of the image.
In order to use 'woocommerce_single' as size, the function needs to be corrected, so the function use the size and not a calculated array of sizes.  wc_get_image_size doesn't return an height for the woocommerce_single size. Further and since the image sizes are declared, there is no need to translate the size to an array.
2018-09-21 19:33:04 +02:00
claudiulodro 08a76e1eea Add srcset handling 2018-09-07 11:36:03 -07:00
Gerhard Potgieter 95a99a93b7 Just use src as there is no first index on src, it just returns the first char of the string which defeats the purpose of the check. 2018-07-19 11:53:28 +02:00
Gerhard Potgieter 2411214091 Forgot src 2018-07-19 11:38:37 +02:00
Gerhard Potgieter dda30061f7 Make sure $attr[0] is set before referencing it. 2018-07-19 11:36:44 +02:00
Tiago Noronha fda124147b phpcs 2018-07-06 16:36:19 +01:00
Tiago Noronha 9970f1799a Add image size filters to wc_get_product_attachment_props() 2018-07-06 16:35:43 +01:00
Mike Jolley ff0e492a41 Setting 2018-06-27 18:38:36 +01:00
Mike Jolley 6b68c15309 Placeholder image styling 2018-06-27 18:13:39 +01:00
Rodrigo Primo 6a4eaa4de5 Check object before calling one of its methods
Check to see if `$product` is an instance of WC_Product before calling WC_Product::get_id() to protect against a fatal error.
2018-05-28 16:36:36 -03:00
Rodrigo Primo 5ed26df842 Product properties should not be accessed directly
Use WC_Product::get_id() instead of WC_Product::ID as product properties should not be accessed directly.

Fixes #20278
2018-05-28 16:32:36 -03:00
Ralf Wiechers 47fbf7eef9
Allow related products limit to be like other post_per_page values
Fix #19994
2018-05-08 11:39:54 +02:00
Khan M Rashedun-Naby f1c359859b Removed redundant else 2018-04-25 14:35:30 +06:00
Peter Fabian 8e8a1ca054 Clear comment count transient when cleaning product transients 2018-04-10 12:12:51 +02:00
Mike Jolley ced5980e79 Tweak `wc_get_price_excluding_tax` to not round the return value so calculations in admin are not pre-rounded. 2018-03-26 12:03:00 +01:00
Mike Jolley 0d624862c2 Use gallery thumbnail size for variation image switcher. 2018-03-09 14:36:14 +00:00
Claudio Sanches da23b0399e Short ABSPATH check 2018-03-08 16:26:01 -03:00
Mike Jolley 04eadf13ac Merge branch 'master' into update/18894 2018-03-08 13:08:40 +00:00
Mike Jolley 39c6c9c72c wc_get_price_excluding_tax handling for woocommerce_adjust_non_base_location_prices 2018-02-23 11:53:05 +00:00
Mike Jolley f8edd02285 phpcbf auto fixes 2018-02-22 15:37:01 +00:00
Mike Jolley 9571a90c9f phpcs 2018-02-22 14:30:13 +00:00
Mike Jolley 0f85e00af1 Product search functions should check for read access, not edit access 2018-02-22 14:11:27 +00:00
Mike Jolley c8b14b6f76 Increase precision from 4 to 6 2018-01-30 15:00:53 +00:00
Mike Jolley 5eb4ed9b64
Merge pull request #18307 from unfulvio/issue-18223-transient
[#18223] Store related posts query arguments in transient
2018-01-03 11:47:15 +00:00
Fulvio Notarstefano b8beb703ef [#18223] Filter results for related products 2017-12-29 12:18:50 +08:00
Fulvio Notarstefano 3045e01f4e [#18223] Store related posts query arguments in transient 2017-12-29 12:12:26 +08:00
Claudiu Lodromanean eb60a17818
Merge pull request #18265 from Miller-Media/millermedia/scheduled_sales_actions
Added actions before & after scheduled sales initiation and completion
2017-12-22 10:23:02 -08:00
Matt Miller 69d9f1f6ff Updated spacing 2017-12-22 09:58:05 -08:00
Matt Miller 4b83514e28 Added actions before and after the scheduled sales initiation and completion 2017-12-21 10:33:08 -08:00
Mike Jolley 5ed3c9e37e Adjusts price filter code to exclude taxes to match how prices are stored in the DB 2017-12-14 15:21:49 +00:00
Mike Jolley 0a9485c465 Merge branch 'master' into feature/11259
# Conflicts:
#	assets/css/admin-rtl.css
#	assets/css/admin.css
#	includes/admin/list-tables/class-wc-admin-list-table-products.php
#	includes/class-wc-install.php
#	includes/wc-update-functions.php
2017-12-04 14:14:03 +00:00
Claudio Sanches 777a004a1f Allow max of 15 products in Recent Viewed Products widget 2017-11-29 19:24:39 -02:00
Claudio Sanches 929eb48fcd Always save last viewed product ID into woocommerce_recently_viewed cookie
Currently if you already visited a product will not be listed at the top
of the "Recent Viewed Products" widget.

This happens because we only include new items if they are not already
in the list of viwed products.

This code changes a little the logic excluding the ID from viewed
products list and adding again.

Closes #17951
2017-11-29 19:21:04 -02:00
claudiulodro c312cc35b1 Add new onbackorder stock status 2017-11-14 13:40:03 -08:00
Mike Jolley db4e630600 Replace thumbnail names 2017-11-07 18:48:51 +00:00
Mike Jolley e025caf177 Widths and aspect ratios 2017-11-07 18:32:43 +00:00
Mike Jolley 130d719d90 Small rounding error in items table 2017-11-02 15:03:43 +00:00
Rodrigo Primo a3f14c7256 Caches call to load product variation attributes
This commit adds product variation attributes to WP cache when they are first loaded to avoid running the same database queries when the same product is loaded multiple times. This cache will be invalidated whenever product attributes are changed.

Fixes #17120
2017-10-27 10:01:23 -02:00
Rodrigo Primo fb70ae3fea Coding standards fixes 2017-10-25 17:53:17 -02:00
Mike Jolley 8eb500b8c1 Allow wc_get_formatted_variation to skip attributes used in the variation's name
Alternative fix for #17004

This matches the cart logic.
2017-10-02 15:50:10 +01:00
Claudio Sanches 03a189726e Introduces woocommerce_get_product_id_by_sku filter
Closes #16559
2017-08-22 15:04:21 -03:00
Rami Yushuvaev d1f4acc730 i18n: Simpler translation string with placeholders
Replace:

`wc_get_product should not be called before the woocommerce_init action.`

With:

`%1$s should not be called before the %2$s action.`
2017-08-16 00:26:14 +03:00
Mike Jolley 39af6fbe94 Add precision to price filter
Closes #16253
2017-08-03 08:17:23 +02:00
claudiulodro e1fad0d7eb Bring up to date with master 2017-07-28 14:27:19 -07:00
claudiulodro d9c2b2cdea Cleanup 2017-07-28 13:38:12 -07:00
claudiulodro 8dc0641149 Remove uneeded parse args 2017-07-28 13:31:53 -07:00
claudiulodro e335724c50 Finalize product query 2017-07-28 11:59:44 -07:00
claudiulodro 96bc5e6f95 cleanup 2017-07-14 10:07:18 -07:00
claudiulodro f66198c37d Initial working wc_get_products 2017-07-14 09:50:20 -07:00
Claudiu Lodromanean 14aaebd3f5 Merge pull request #16094 from woocommerce/fix/15256
Check we have an object before using product props
2017-07-12 08:25:04 -07:00
Mike Jolley b3e0804462 Check we have an object before using product props
Fixes #15256
2017-07-12 15:58:54 +01:00
Mike Jolley 022c528b3e Remove value renaming code 2017-07-12 15:18:05 +01:00
Mike Jolley ae0e03ef53 wc_products_array_filter_visible_grouped method 2017-06-20 15:00:58 +01:00
Mike Jolley 4a4e201888 Copy tweaks for catalog visibility
Ref #15604
2017-06-14 12:07:20 +01:00
Mike Jolley 282bf0fd68 Cleanup 2017-06-13 11:41:44 +01:00
yachmenov_c_ ab7a3b625c #15584 - is_wp_error() checking added to prevent fatal 2017-06-13 11:19:56 +03:00
Mike Jolley d3666738d8 Merge branch 'pr/15069' 2017-05-23 18:56:58 +01:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus Bengtsson 6a7fc8650f Remove unused local variables 2017-05-15 12:06:52 +02:00
Claudio Sanches 58fa8542b6 Merge pull request #14933 from woocommerce/fix/14815
Use numeric, not decimal
2017-05-08 15:36:39 -03:00
Mike Jolley bdd3eba7c4 Use correct full size for variation images
Closes #14866
2017-05-08 14:35:07 +01:00
Mike Jolley 885e332f5a Use numeric, not decimal
Closes #14815
2017-05-08 12:34:00 +01:00
Mike Jolley eedcdd97ba Compare with timestamp and remove start date once passed for sale products
Fixes #14753
2017-04-27 14:35:33 +01:00
Mike Jolley aacb01d1e7 Merge branch 'pr/13503'
# Conflicts:
#	assets/css/twenty-seventeen.css
#	assets/css/woocommerce-layout.css
#	assets/css/woocommerce-layout.scss
#	assets/css/woocommerce.css
2017-04-27 12:46:05 +01:00
Mike Jolley c454abc787 Remove attribute_ prefix from names in wc_get_formatted_variation
Fixes #14469
2017-04-18 13:08:39 +01:00
Mike Jolley f9dd3310b2 Unfiltered context rather than true 2017-04-13 12:38:54 +01:00
Mike Jolley 7274c14591 Use correct thumbnail for variation images in gallery
Fixes #14213
2017-04-10 23:02:53 +01:00
Mike Jolley 47411f7397 wc_deferred_product_sync queue function 2017-04-06 12:25:54 +01:00
Mike Jolley 489ebedfcd Use floats for qty
Fixes #13728
2017-03-23 11:18:41 +00:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Manos Psychogyiopoulos 5e8df27945 fix wc_get_price_{in/ex}cluding tax behavior with zero/empty inputs 2017-03-08 18:21:36 +02:00
Aristeides Stathopoulos 10ffc92a73 Inline control structures are not allowed 2017-03-07 22:24:24 +02:00
Claudio Sanches bf51da64d7 Merge branch 'master' into fix-13335 2017-02-24 16:07:00 -03:00
Mike Jolley 6bc97dce91 wc_product_force_unique_sku edit context 2017-02-24 11:43:58 +00:00
Mike Jolley 2f44e5769b Don't adjust empty skus 2017-02-23 10:04:58 +00:00
Mike Jolley c44fffe35b If woocommerce_adjust_non_base_location_prices is false, remove modded tax, not base tax 2017-02-06 16:56:14 +00:00
Mike Jolley dc82ea9c77 Add some functions to handle unique sku after untrash 2017-01-11 15:41:31 +00:00
Manos Psychogyiopoulos 022fbe4183 add 'include' arg to wc_get_products 2017-01-09 14:10:47 +02:00