Commit Graph

317 Commits

Author SHA1 Message Date
Rodrigo Primo fa0e5569f8 Add 'parent' to the list of valid tax classes for product variations
Commit d9f9e74bd added a check to `WC_Product::set_tax_class()` to only accept valid tax classes, but this created a bug for product variations as this type of product has an extra tax class called 'parent'.

This commit fixes this problem by adding a new method to `WC_Product` that returns a list of valid tax classes. `WC_Product_Variation` then override this method, returning another list including the tax class 'parent'.

Fixes #17024
2017-10-09 16:20:03 -03:00
Rodrigo Primo d769ef24f2 Coding standards fixes 2017-10-09 16:19:24 -03:00
Mike Jolley d09d7d1358 wc_get_relative_url/wc_is_external_resource helpers 2017-09-08 12:20:03 +01:00
Mike Jolley ee3ea1b739 Only make http resources relative - https can be left alone.
Closes #16737
2017-09-07 16:55:29 +01:00
Mike Jolley c60859bf3c types 2017-08-23 14:27:10 +01:00
Mike Jolley d9f9e74bd9 Only set valid tax classes in product abstract 2017-08-18 17:06:22 +01:00
Jaydeep Rami 46d3638089 Fix missing return statement (#16148)
* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement
2017-07-20 18:01:14 +01:00
Jaydeep Rami 3522857d23 Fix typo in WooCommerce plugin (#16135)
* Fixed typo

* Fixed more typo

* Fixed more typo

* Fix tyop

* Fix more typo

* Fix more typo

* Fix typo

* Fix typo

* Fix typo

* Fix typo datatime object

* Fix short name of compat

* Fix typo: update short name

* Fix typo "deactive" to "deactivate" and short BW - Compat

* Fix typo "Backwards compat"

* Fix typo 'parameters'

* Fix more typo 'pararmeters'

* Fix typo 'compund'

* FIx typo order

* Fix typo

* Fix typo 'incorrecly'

* Fix typo 'genarate'

* Fix typo 'reletive'

* Fix typo 'Handly'

* Fix typo 'rotatated'

* Fix typo

* Fix typo 'additonal'

* Fix typos
2017-07-17 11:10:52 +01:00
Akeda Bagus 53807185a8
Fixed typos.
These typos are catched by `misspell` program.

```
find . -type f | grep -v assets | grep -v dummy-data | grep -v i18n | grep -v node_modules | grep -v .git | grep -v apigen |  xargs misspell -w
```

Some results were excluded because of 3rd party ownership and non-english
sentences.
2017-07-10 12:56:28 +07:00
Mike Jolley 38bcdcfb28 Use get_max_purchase_quantityin cart template and fix logic
Closes #15329
2017-05-30 11:02:56 +01:00
Mike Jolley a3b89a9efc Merge pull request #15144 from timondavis/fix/15103-cannot_set_default_variation_to_string_zero
#15103 Variation default value of '0' fails to save on product.
2017-05-23 19:31:38 +01:00
Timon Davis af308da6b9 Fix bug #15103 where site operator cannot assign a variation with value of '0' as the default choice on the customer facing form.
The WC_Product::set_default_attributes function uses an array_filter (using the default callback for filtration)
to remove null and false values from the defaults array for a given product.  The issue here is that, in the above use case,
the array_filter will evaluate '0' as 0 and therefore as false.  Ultimately, array_filter then prevents the value from being
recorded, moving forward.

I've added a new filter callback to includes/wc-attribute-functions which will disregard all FALSE PHP equivalents except for
'0' (as a a string).  Also, I've updated the filter_array call in WC_Product::set_default_attributes so that it uses this new callback,
instead of the PHP default. Finally, I've added a phpunit test to assert that, when storing default variations / attributes on a product,
the false/true PHP synonyms are evaluating and storing like one would normally expect, with the exception that (string) '0'
evaluates as true in this special case.

This solution could potentially be broadened to facililate similar rules elsewhere, but the need raised in the bug is specific and
this is a specific solution.
2017-05-18 02:43:14 -07:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus 98833fa9c5 Fix param documentation for WC_Product::is_type 2017-05-09 14:10:27 +02: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 a6329fa68c Merge pull request #14752 from woocommerce/pr/14732
revert price handling of get_price_html()
2017-04-27 13:03:15 +01:00
Mike Jolley db5e2572f6 clean up 2017-04-27 13:01:52 +01:00
Kathy Darling 36dbe64170 revert price handling so null price still is filtered by woocommerce_get_price_html. closes #14727. 2017-04-26 12:37:30 -05:00
Mike Jolley 69a8b6c9b5 When on backorder without notifications, hide the text
Fixes #14530
2017-04-19 16:57:49 +01:00
Claudiu Lodromanean 94814a0b03 Dont throw exceptions when reading 2017-04-06 13:39:36 -07:00
Mike Jolley fe42b2565c Defer variation parent sync to shutdown rather than cron 2017-04-06 12:25:34 +01:00
Gregory Karpinsky 37c7e2a615 Docblock fix
`get_availability` returns array of strings
2017-04-06 00:32:36 -04:00
Mike Jolley c06fdc2e2e If product has_options, don't show qty in grouped product add to cart form
Fixes #13875
2017-04-03 12:05:28 +01:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Mike Jolley d55653a408 Merge branch 'master' into fix-13498
# Conflicts:
#	includes/class-wc-order.php
#	tests/unit-tests/crud/data.php
2017-03-15 15:52:40 +00:00
JeroenSormani 08e441149b Remove @(deprecated) sign from docblock to prevent false notice in editors 2017-03-15 09:46:17 +01:00
Mike Jolley 1bac579df7 Date getters and setters 2017-03-13 19:52:44 +00:00
Mike Jolley 5bdeddcb32 Hide suffix on variable product when dynamic.
Closes #13494
2017-03-07 13:25:52 +00:00
Claudio Sanches 7adb472a1c Fixed extra argument on array_map while setting categories and tags ids 2017-03-03 16:26:57 -03:00
Claudio Sanches a4b7cc5f0d Accept only list of terms IDs for product categories and tags 2017-03-03 16:19:32 -03:00
Mike Jolley 6201c7e22b Add get_min_purchase_quantity and max helper 2017-02-17 15:52:39 +00:00
Mike Jolley b37e4da43c Move legacy classes to correct dir 2017-02-16 16:39:56 +00:00
Mike Jolley bdf567e90d Adjust how product_type is deprecated 2017-02-13 14:31:43 +00:00
Mike Jolley eb518ec06d Only append tax price suffix if taxable 2017-02-11 00:08:49 +00:00
Mike Jolley 5888ef5b93 Convert standard to '' in CRUD
Closes #12896
2017-02-07 17:22:04 +00:00
Mike Jolley 2ec4b8cf7f Revert "Get rating count should use is_array"
This reverts commit 0625a2b759.
2017-02-02 18:43:43 +01:00
Mike Jolley 0625a2b759 Get rating count should use is_array 2017-02-02 18:35:30 +01:00
Brent Shepherd 2cf401f60f Delete WC_Product::get_data()
It's identical to WC_Data::get_data(), which is already inherited from
WC_Abstract_Legacy_Product (which extends WC_Data::get_data()).
2017-01-24 10:44:51 -08:00
Claudio Sanches bac0b299c4 Include conflicted product ID when trying to create a product with duplicated SKU 2017-01-23 17:34:49 -02:00
Claudio Sanches bd655af072 Restore attributes ordering, closes #12847 2017-01-16 21:11:56 -02:00
Claudio Sanches 20032fd170 Fixed declaration of is_on_sale() compatible with WC_Product::is_on_sale 2017-01-16 19:59:53 -02:00
roykho 11d0d26df7
Fix typo on variable when it should be 2017-01-16 12:54:59 -08:00
Manos Psychogyiopoulos 892d5da7e9 get prices in 'edit' context when updating meta 2017-01-16 17:33:30 +02:00
Mike Jolley 11015c4b06 Pass products around and change how wc_format_stock_for_display gets called so $product is available. 2017-01-11 12:17:18 +00:00
Mike Jolley 6b511e84be Sorting 2016-12-23 15:14:27 +00:00
Mike Jolley 20680203bb Add actions for all object types 2016-12-19 17:09:52 +00:00
Mike Jolley 1e80db6021 Force meta to be written on creation
#12567
2016-12-12 13:56:35 +00:00
Mike Jolley 90ff6705be Only validate attachment IDs when set after read 2016-12-08 16:08:10 +00:00
Mike Jolley 47fbae4d26 Product Visibility Taxonomies (#12527)
* Convert visibility and featured to taxonomy

* Comment

* Add missing tax_queries

* Only check SKU after read.

* Added visibility term for outofstock products to speed those queries up al

* wc_bool_to_string
2016-12-08 10:56:45 +00:00
Mike Jolley 070926f7e6 woocommerce_downloadable_file_hash filter
Closes #12444
2016-12-06 11:09:03 +00:00