* Removed extra double quotation from the image tag
* Fixed typo in the init() method
* Moved init() method body into the constructor -- a separate method is not necessary
The WC_REST_Terms_Controller and WC_REST_Product_Attributes_V1_Controller
classes have a get_taxonomy method that gets the name of the taxonomy
to process from a taxonomy id passed in the request, but once the
taxonomy name has been obtained it's cached and sbsequently reused.
The problem is that these controller instances are reused if more than
one request is processed programmatically, and thus the taxonomy that
was cached once is always used even if the new request specifies a
different taxonomy id.
The fix consists of using a dictionary of taxonomy id - taxonomy name
instead of one single taxonomy for caching.
In the case of WC_REST_Terms_Controller there's a protected $taxonomy
property that needs to be kept for compatibility, it's now set to
the last taxonomy name that has been introduced in the dictionary.
- Allow the list of line items to be a non-associative array
where each item is identified by an "id" field
- Same for taxes inside line items, specify amount to refund in
a "refund_total" key as in the case of line items
- Allow "quantity" keys as synonyms of "qty"
Also calculate "amount" automatically if missing and when all the
line items and taxes have a valid "refund_total" key.
The price filtering query wasn't working properly when there are
variations with different prices: if at least one variation was
outside of the price range but other were inside, the product wasn't
being listed.
The DownloadPermissionsAdjuster class hooks to adjust_download_permissions
from within its init method. However this method is executed only
if the class is resolved, otherwise the hooks doesn't get attached
and then the scheduled action is not serviced.
To solve this, the class is resolved from WooCommerce::init_hooks.
This requires a change in DownloadPermissionsAdjuster::init
to use wc_get_container()->get( LegacyProxy::class )->get_instance_of
instead of WC()->get_instance_of, since WC() can't be used from
WooCommerce::construct (which invokes init_hooks).
We are using func_get_arg method to receive argument in a backward compatible way since we cannot modify function signature to add more params even with default params. Earlier I was hoping to use DI to create another child class with modified signature and load it depending upon where we are executing from, however since we had to revert DI, we add this workaround to unblock #27735.