woocommerce/plugins/woocommerce/includes
Albert Juhé Lluveras b07005afd1
Fix commands with tags breaking the command palette (#43269)
* Fix commands with tags breaking the command palette

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-05 10:41:37 +01:00
..
abstracts Revert "Fix schedule sales error" (#43094) 2023-12-22 18:20:56 -03:00
admin Fix commands with tags breaking the command palette (#43269) 2024-01-05 10:41:37 +01:00
blocks create BlocksUtil file - refactor 2022-05-02 11:26:34 +02:00
cli capitalize Woo.com when used in a sentence 2023-11-10 15:49:08 +01:00
customizer Enable WC Customizer panels in customize.php routes also for block themes (#34443) 2022-08-30 12:47:10 +02:00
data-stores Invalidate coupon cache after hold/usage data is modified in datastore via SQL (#41538) 2023-11-17 15:25:10 +00:00
emails update references to woocommerce.com to now reference woo.com 2023-11-10 15:49:08 +01:00
export update list of CSV characters to prepend with a tick when occurring at the beginning of a cell 2023-11-15 13:43:46 +01:00
gateways Update class-wc-gateway-bacs.php (#43054) 2023-12-21 19:54:12 +01:00
import Add product image by SKU (#40076) 2023-12-18 10:13:11 -04:00
integrations/maxmind-geolocation update references to woocommerce.com to now reference woo.com 2023-11-10 15:49:08 +01:00
interfaces Fix docblock type annotations for `$meta_value` parameter. (#33853) 2022-12-20 03:02:17 -08:00
legacy Add logging and an admin notice for Legacy REST API usages (#41804) 2023-12-20 11:34:31 +00:00
libraries Update wp-background-process.php to use wp_convert_hr_to_bytes() (#30908) 2022-07-04 19:23:52 -07:00
log-handlers Improve backtrace getter 2023-12-06 16:05:26 -08:00
payment-tokens git mv a few folders 2021-10-19 10:35:45 +13:00
queue Fix typos in phpdocs and comments 2022-02-01 17:06:58 +02:00
react-admin Fix absolute imports (#37058) 2023-03-06 19:38:52 +08:00
rest-api Layout templates REST API (#43067) 2024-01-03 20:02:38 -05:00
shipping Fix shipping cost formatting to respect shipping formula (#42916) 2023-12-21 10:25:43 +13:00
shortcodes Cart shortcode: Format postcode before validation on the shipping calculator (#41917) 2023-12-06 16:43:57 -08:00
theme-support Adjust indents of old notice styles (#43031) 2023-12-21 17:10:14 +07:00
tracks Update tracks events hooks for HPOS (#42879) 2023-12-29 08:46:59 +00:00
traits git mv a few folders 2021-10-19 10:35:45 +13:00
walkers git mv a few folders 2021-10-19 10:35:45 +13:00
wccom-site Fix occurrences where Installer_Error exception is returned instead of being thrown (#43108) 2024-01-03 14:59:08 -08:00
widgets Remove the global wc-cart-fragments enqueue (#35530) 2023-05-19 13:53:41 +01:00
README.md Fix internal links in README files 2022-02-25 11:27:58 +01:00
class-wc-ajax.php Fix product variation sale_price_dates_to not being set to 23:59:59 when it's set via the variation bulk actions (#41564) 2023-11-30 14:54:05 +00:00
class-wc-api.php Fix typos in phpdocs and comments 2022-02-01 17:06:58 +02:00
class-wc-auth.php Changes to class-wc-auth that allows it to work with sso auth 2022-03-23 15:51:42 +02:00
class-wc-autoloader.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-background-emailer.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-background-updater.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-breadcrumb.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-cache-helper.php Move the namespace algorithm functions to dedicated CacheNameSpaceTrait. 2023-01-25 13:47:12 +05:30
class-wc-cart-fees.php Change deprecated version 2023-09-06 20:29:37 +02:00
class-wc-cart-session.php Cart: Force calculate totals when ordering again (#42921) 2023-12-19 16:58:41 -08:00
class-wc-cart-totals.php Fix dynamic prop declaration warning in cart code 2023-06-02 12:42:55 -05:00
class-wc-cart.php Check store api draft order on short code for reserved stock (#42796) 2023-12-20 06:18:47 -08:00
class-wc-checkout.php Check if $data['billing_email'] is set (#41098) 2023-11-14 19:18:42 +00:00
class-wc-cli.php Add the wp wc com extension list command (#33783) 2022-07-14 13:18:50 -03:00
class-wc-comments.php Product review page in WooCommerce Core (#32763) 2022-06-05 10:45:28 -07:00
class-wc-countries.php Update state definitions for Liechtenstein and Chile (#41068) 2023-11-01 05:37:22 -07:00
class-wc-coupon.php Fixes typo mistake in coupon error message 2023-09-26 13:22:38 -07:00
class-wc-customer-download-log.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-customer-download.php Add ReturnTypeWillChange attribute to classes implementing ArrayAccess 2021-11-24 16:22:49 +01:00
class-wc-customer.php Tweak a few comments related to address type (#40110) 2023-09-20 08:48:06 +02:00
class-wc-data-exception.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-data-store.php Support fetching order types in bulk. (#34976) 2022-10-11 11:44:50 -07:00
class-wc-datetime.php Add more "#[\ReturnTypeWillChange]" attributes. 2022-03-24 14:08:18 +01:00
class-wc-deprecated-action-hooks.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-deprecated-filter-hooks.php Properly deprecate woocommerce_my_account_my_orders_columns filter (#36356) 2023-01-31 13:02:42 -08:00
class-wc-discounts.php Fix TypeError in WC_Discounts->apply_coupons() when being called a second time [redux] (#41602) 2023-11-22 15:52:24 +00:00
class-wc-download-handler.php Add inline file delivery to WC_Download_Handler (#31145) 2022-08-25 11:03:03 -07:00
class-wc-emails.php update references to woocommerce.com to now reference woo.com 2023-11-10 15:49:08 +01:00
class-wc-embed.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-form-handler.php Tweak a few comments related to address type (#40110) 2023-09-20 08:48:06 +02:00
class-wc-frontend-scripts.php Leverage Script API strategy feature to defer front end scripts in WP >=6.3 (#40686) 2023-10-19 15:45:37 +08:00
class-wc-geo-ip.php Rename Swaziland to Eswatini 2021-11-13 18:38:30 +02:00
class-wc-geolite-integration.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-geolocation.php class-wc-geolocation.php: hide blog URL from third-party providers (#31941) 2022-06-24 17:34:29 -03:00
class-wc-https.php cast url to string for str_replace (#38530) 2023-05-31 12:25:21 +02:00
class-wc-install.php update references to woocommerce.com to now reference woo.com 2023-11-10 15:49:08 +01:00
class-wc-integrations.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-log-levels.php Simplify retrieval of severity levels 2023-11-09 10:23:36 -08:00
class-wc-logger.php Logging: Improve functionality in new LogHandlerFileV2 handler class (#41802) 2023-12-18 10:42:17 -08:00
class-wc-meta-data.php Add more "#[\ReturnTypeWillChange]" attributes. 2022-03-24 14:08:18 +01:00
class-wc-order-factory.php Fix typo. 2023-03-14 17:28:50 +05:30
class-wc-order-item-coupon.php Add ReturnTypeWillChange attribute to classes implementing ArrayAccess 2021-11-24 16:22:49 +01:00
class-wc-order-item-fee.php Add ReturnTypeWillChange attribute to classes implementing ArrayAccess 2021-11-24 16:22:49 +01:00
class-wc-order-item-meta.php use native wp_doing_ajax instead of custom is_ajax 2021-11-09 17:55:02 +01:00
class-wc-order-item-product.php Update documentation in class-wc-order-item-product.php (#41160) 2023-12-20 13:52:00 -08:00
class-wc-order-item-shipping.php Add ReturnTypeWillChange attribute to classes implementing ArrayAccess 2021-11-24 16:22:49 +01:00
class-wc-order-item-tax.php Add ReturnTypeWillChange attribute to classes implementing ArrayAccess 2021-11-24 16:22:49 +01:00
class-wc-order-item.php Add get_all_formatted_meta_data wrapper 2021-11-26 15:48:06 +00:00
class-wc-order-query.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-order-refund.php Removed unused method call and added unit tests. 2023-07-13 18:16:14 +05:30
class-wc-order.php Revert "Add woocommerce_order_has_downloadable_item filter to WC_Order->has_downloadable_item()" 2023-12-05 13:29:35 -08:00
class-wc-payment-gateways.php Ensure the gateway activation email does not depend on the gateway title being stored in the settings option (#42992) 2023-12-20 13:44:30 -08:00
class-wc-payment-tokens.php fix get customer tokens limit (#29850) 2022-11-17 03:55:12 -08:00
class-wc-post-data.php Use posts before delete hook along with HPOS one. 2023-02-27 17:07:59 +05:30
class-wc-post-types.php Move template addition to feature flag (#38276) 2023-05-12 13:28:57 -03:00
class-wc-privacy-background-process.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-privacy-erasers.php Fix typos in phpdocs and comments 2022-02-01 17:06:58 +02:00
class-wc-privacy-exporters.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-privacy.php When removing customer accounts, their content should be preserved. (#38837) 2023-06-21 14:03:01 -03:00
class-wc-product-attribute.php Fix PHPDoc Type 2022-01-07 11:50:53 +02:00
class-wc-product-download.php update references to woocommerce.com to now reference woo.com 2023-11-10 15:49:08 +01:00
class-wc-product-external.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-product-factory.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-product-grouped.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-product-query.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-product-simple.php Added ':' between static translation and dyanmic product name 2023-11-14 17:55:13 +02:00
class-wc-product-variable.php Fix/37601 Add `aria-describedby` to Select options button (#37880) 2023-05-12 16:16:38 -03:00
class-wc-product-variation.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-query.php Fix/37502: Correct spelling errors. (#37887) 2023-05-08 15:55:09 +08:00
class-wc-rate-limiter.php Update db table name to use the new convention. 2021-11-26 11:35:29 +01:00
class-wc-regenerate-images-request.php Use Imagick instead of putenv() to only use 1 thread and avoid memory issues with OpenMP (#35339) 2022-12-16 09:48:13 -08:00
class-wc-regenerate-images.php Fix/37502: Correct spelling errors. (#37887) 2023-05-08 15:55:09 +08:00
class-wc-register-wp-admin-settings.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-rest-authentication.php Added a woocommerce_disable_api_access_log filter. (#37332) 2023-04-17 09:40:27 +02:00
class-wc-rest-exception.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-session-handler.php [Fix] Undefined array key 1, 2, 3 when using list to extract woocommerce cookie values. 2023-05-15 11:44:23 +02:00
class-wc-shipping-rate.php Fix wrong return type get shipping tax (#35453) 2022-11-03 11:08:14 +01:00
class-wc-shipping-zone.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-shipping-zones.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-shipping.php add phpdoc block with gist reference to woocommerce_package_rates filter 2021-10-19 13:15:43 -03:00
class-wc-shortcodes.php git mv a few folders 2021-10-19 10:35:45 +13:00
class-wc-structured-data.php improve 2023-04-19 21:35:22 +07:00
class-wc-tax.php fix Unsupported operand string * float 2023-05-30 15:25:28 -03:00
class-wc-template-loader.php Load `taxonomy-pa_<slug>` template before `taxonomy-product_attribute` (#37552) 2023-06-21 16:15:17 -03:00
class-wc-tracker.php capitalize Woo.com when used in a sentence 2023-11-10 15:49:08 +01:00
class-wc-validation.php Validate Norweigan postcodes/rework code for 4-digit post code validation (#36277) 2023-01-09 12:11:22 +01:00
class-wc-webhook.php Add HPOS order trashing/untrashing to webhooks 2023-08-11 20:11:47 -03:00
class-woocommerce.php Prep trunk for 8.6 cycle (#43021) 2023-12-22 09:27:54 +01:00
wc-account-functions.php Tweak a few comments related to address type (#40110) 2023-09-20 08:48:06 +02:00
wc-attribute-functions.php Fix attribute taxonomy sort order meta key (#34645) 2022-11-23 12:50:25 -08:00
wc-cart-functions.php Also check for instanceof WC_Order here to be consistent with the implementation above 2023-08-25 14:17:44 +02:00
wc-conditional-functions.php Make is_checkout() description more accurate 2023-09-18 21:51:53 +00:00
wc-core-functions.php Logging: Update doc block to more accurate return value 2023-12-04 13:06:31 -08:00
wc-coupon-functions.php Fix: can't apply or remove a coupon whose code is "0". 2023-02-23 11:49:38 +01:00
wc-deprecated-functions.php Fix docblock type annotations for `$meta_value` parameter. (#33853) 2022-12-20 03:02:17 -08:00
wc-formatting-functions.php Remove legacy PHP version checks (#39845) 2023-08-23 09:42:59 +02:00
wc-notice-functions.php Legacy shortcodes: block editor compatibility (#40648) 2023-10-27 08:30:31 +02:00
wc-order-functions.php Fix the wc_update_total_sales_counts function 2023-07-11 09:02:42 +09:00
wc-order-item-functions.php Fix docblock type annotations for `$meta_value` parameter. (#33853) 2022-12-20 03:02:17 -08:00
wc-page-functions.php Update wc-page-functions.php (#38008) 2023-06-07 11:08:36 +02:00
wc-product-functions.php Add product image by SKU (#40076) 2023-12-18 10:13:11 -04:00
wc-rest-functions.php Added WebP support, at allowed_image_mime_types 2023-03-21 22:44:14 +02:00
wc-stock-functions.php Added woocommerce_reduce_order_item_stock action hook to let other plugin hook functionalities without looping through the order items again and again. (#34721) 2023-03-08 18:05:40 -03:00
wc-template-functions.php Add HTML5 theme support to NO JS handling (#42753) 2023-12-15 09:15:14 -08:00
wc-template-hooks.php git mv a few folders 2021-10-19 10:35:45 +13:00
wc-term-functions.php Fix/37502: Correct spelling errors. (#37887) 2023-05-08 15:55:09 +08:00
wc-update-functions.php Introduce the transient files engine (#42877) 2023-12-22 08:44:18 +01:00
wc-user-functions.php Avoing string to int comparison and add the id clause only when available. 2023-09-05 11:22:33 +05:30
wc-webhook-functions.php Respect the $limit parameter (0) 2022-03-01 17:45:13 -03:00
wc-widget-functions.php git mv a few folders 2021-10-19 10:35:45 +13:00

README.md

WooCommerce includes files

This directory contains WooCommerce legacy code. Ideally, the code in this folder should only get the minimum required changes for bug fixing, and any new code should go in the src directory instead.

Interacting with the src folder

Whenever you need to get an instance of a class from the src directory, please don't instantiate it directly, but instead use the container. To get an instance of the container itself you can use the wc_get_container function, for example:

$container = wc_get_container();
$service = $container->get( \Automattic\WooCommerce\TheNamespace\TheService::class );
$service->do_something();

The exception to this rule might be data-only classes that could be created the old way (using a plain new statement); but in general, all classes in the src directory are registered in the container and should be resolved using it.

Adding new actions and filters

Please take a look at the considerations for creation new hooks in src code, as they apply for includes code as well. The short version is that new hooks should be introduced only if they provide a valuable extension point for plugins, and not with the purpose of driving WooCommerce's internal logic.

Writing unit tests

As it's the case for the src folder, writing unit tests is generally mandatory if you are a WooCommerce team member or a contributor from another Automattic team, and encouraged if you are an external contributor. Tests should cover any new code (although as mentioned, adding new code in includes should be rare) and any modifications to existing code.

In order to make it easier to write unit tests, there are a couple of mechanisms in place that you can use:

  • The code hacker. Pros: you don't need to do any special changes to your code to make it testable. Cons: it's a hack, the tested code is being actually modified while being loaded by the PHP engine, so not an ideal solution.

  • The legacy proxy and the related helper methods in WC_Unit_Test_case: although these are intended in principle for writing tests for code in the src directory, they can be used for includes code as well. Pros: a clean approach, no hacks involved. Cons: you need to modify your code to use the proxy whenever you need to call a function or static method that makes the code difficult to test.

It's up to you as a contributor to decide which mechanism to use in each case. Choose wisely.