woocommerce/includes
Néstor Soriano 69203f2924
Merge pull request #30650 from woocommerce/fix/29890
Add individual item remove notices for shipping and fees closes #29890
2021-09-15 17:05:52 +02:00
..
abstracts Implement the product attributes lookup table data creation. 2021-06-08 17:53:45 +02:00
admin Merge pull request #30650 from woocommerce/fix/29890 2021-09-15 17:05:52 +02:00
blocks Review refactor. 2021-01-06 15:28:51 +01:00
cli switch to using a Formatter for more flexible output, improve docs 2021-06-02 15:49:25 +12:00
customizer Remove P2 reference 2021-06-09 14:14:21 +02:00
data-stores Revert "Fix: the same set of related products is always displayed" 2021-08-17 06:43:13 -07:00
emails Apply suggestions from code review 2021-06-22 15:37:18 -03:00
export Merge pull request #29749 from ovidiul/vip/fix_batch_export 2021-06-25 09:34:23 +02:00
gateways Merge pull request #29971 from woocommerce/hide-pypl-on-new-sites 2021-06-17 19:40:53 +05:30
import Update importer to grab downloads id from export file when updating rows 2021-06-15 10:06:37 -05:00
integrations/maxmind-geolocation Replace 'DIRECTORY_SEPARATOR' with '/' 2020-08-26 15:50:34 -05:00
interfaces Remove ASBPATH check from interfaces 2021-06-03 13:02:19 -03:00
legacy Fixed usage of package tag in REST API and templates 2020-09-17 11:56:08 -03:00
libraries Don't echo error when doing AJAX because it invalidates JSON 2020-03-17 16:49:52 +05:30
log-handlers removed excess indentation 2021-03-18 18:19:40 +01:00
payment-tokens Fixed package tag usage 2020-08-05 13:36:24 -03:00
queue Fix the usage of FakeQueue in DataRegeneratorTest. 2021-05-05 11:11:36 +02:00
rest-api Add 'modified_before' and 'modified_after' to get_collection_params. 2021-08-26 15:43:30 +02:00
shipping Update deprecated jQuery functions in includes folder 2021-04-28 16:21:59 -05:00
shortcodes Fixed return type of $type in docblock 2021-03-21 09:08:36 +06:00
theme-support Revert #28187 2021-05-21 12:10:15 -07:00
tracks Updated `track_extensions_page` to record new Tracks event `wcadmin_subscriptions_view` if the user views the My Subscriptions page. 2021-08-12 14:50:55 +01:00
traits Add a 'NumberUtil' class with a 'round' method. 2020-10-01 11:08:51 +02:00
walkers Convert optional-before-required arguments to required (take 2) 2020-10-16 13:08:31 +02:00
wccom-site Fixed incorrect package tags 2020-08-05 17:49:10 -03:00
widgets Merge pull request #29896 from woocommerce/add/29610 2021-06-08 07:37:06 -07:00
README.md Update default GIT branch 2021-02-25 20:51:14 -03:00
class-wc-ajax.php fixed by putting strip all tag 2021-07-18 17:29:33 +05:30
class-wc-api.php Fixed usage of package tag in REST API and templates 2020-09-17 11:56:08 -03:00
class-wc-auth.php Fixed usage of package tag in REST API and templates 2020-09-17 11:56:08 -03:00
class-wc-autoloader.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-background-emailer.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-background-updater.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-breadcrumb.php support overriding/customising password reset page title via `action`: 2020-10-14 09:50:36 +13:00
class-wc-cache-helper.php Remove comment that it includes checkout page 2021-05-17 12:50:38 -07:00
class-wc-cart-fees.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-cart-session.php Update the persistant cart after it's loaded on log in 2021-03-29 15:28:34 +10:00
class-wc-cart-totals.php Cast quantities to floats, not ints, as the test suite documents cases for fractional quantities. 2021-08-12 16:56:17 -07:00
class-wc-cart.php Restore formatting but without rounding for backward compat. 2021-05-07 14:58:52 +05:30
class-wc-checkout.php Fix Code Sniffer error 2021-05-17 18:35:18 -05:00
class-wc-cli.php add a CLI command for dumping tracker data to terminal 2021-05-31 14:55:29 +12:00
class-wc-comments.php Check if is required a verified product owner before placing a review 2021-03-30 11:07:34 +02:00
class-wc-countries.php Ensure countries that have no states hides states field closes #28944 2021-08-17 14:50:48 +05:30
class-wc-coupon.php Use correct syntax for translators comments. 2020-12-21 15:33:10 +05:30
class-wc-customer-download-log.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-customer-download.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-customer.php Remove \WC_Customer::get_hook_prefix method 2021-07-29 11:26:21 +09:30
class-wc-data-exception.php
class-wc-data-store.php Use the spread operator instead of call_user_func_array() in WC_Data_Store 2019-11-21 11:52:47 -03:00
class-wc-datetime.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-deprecated-action-hooks.php
class-wc-deprecated-filter-hooks.php apply_filters_deprecated to avoid conflict with wp profile 2019-01-30 16:06:51 +00:00
class-wc-discounts.php Cast quantities to floats, not ints, as the test suite documents cases for fractional quantities. 2021-08-12 16:56:17 -07:00
class-wc-download-handler.php Download handler: support falling back on the redirect method as an option. 2021-07-20 11:18:22 -07:00
class-wc-emails.php Revert "pass email object to header and footer templates" 2021-01-18 16:51:31 +05:30
class-wc-embed.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-form-handler.php Add order_id to checkout result response 2021-03-13 10:52:08 +01:00
class-wc-frontend-scripts.php Update to use our own custom versioning 2021-07-20 05:59:35 -07:00
class-wc-geo-ip.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-geolite-integration.php Added a deprecation to the old Geolite library wrapper class' public methods 2020-01-14 13:44:41 -08:00
class-wc-geolocation.php Set geolocation transients to expire in one day 2021-05-25 17:59:50 -03:00
class-wc-https.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-install.php Revise logic to hook into admin_init to trigger adding note instead of scheduling 2021-07-06 09:21:42 -07:00
class-wc-integrations.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-log-levels.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-logger.php Update docblock 2021-04-13 17:21:00 -05:00
class-wc-meta-data.php
class-wc-order-factory.php Removed/reverted more unnecessary changes. 2020-11-10 14:23:43 +05:30
class-wc-order-item-coupon.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-order-item-fee.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-order-item-meta.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-order-item-product.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-order-item-shipping.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-order-item-tax.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-order-item.php Removed/reverted more unnecessary changes. 2020-11-10 14:23:43 +05:30
class-wc-order-query.php Add shipping phone to data stores 2021-06-03 13:55:37 +01:00
class-wc-order-refund.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-order.php Include since tag to new methods 2021-07-20 20:55:39 -03:00
class-wc-payment-gateways.php No longer load PayPal Standard on new installs 2021-05-24 16:04:01 +10:00
class-wc-payment-tokens.php Fix typos in comments 2021-01-22 17:13:49 +01:00
class-wc-post-data.php Add tests for product deletion in LookupDataStoreTest. 2021-06-17 15:31:23 +02:00
class-wc-post-types.php Change the shop page summary 2021-08-25 11:41:32 +02:00
class-wc-privacy-background-process.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-privacy-erasers.php Cleanup shipping phone in privacy classes 2021-06-03 13:57:00 +01:00
class-wc-privacy-exporters.php Cleanup shipping phone in privacy classes 2021-06-03 13:57:00 +01:00
class-wc-privacy.php Update class-wc-privacy.php 2021-08-12 15:26:45 +02:00
class-wc-product-attribute.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-product-download.php Fix tests 2021-02-16 16:19:55 +01:00
class-wc-product-external.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-product-factory.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-product-grouped.php Only use default message to avoid showing too much information to user 2019-07-19 15:37:10 -06:00
class-wc-product-query.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-product-simple.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-product-variable.php Refactor save method in WC_Product and WC_Product_Variable 2021-06-04 12:21:29 +02:00
class-wc-product-variation.php Remove superfluous 'delete' method in WC_Product_Variation class. 2021-06-07 16:52:22 +02:00
class-wc-query.php Remove unnecessary search 'where' in handling of 'posts_clauses' 2021-07-22 11:26:10 +02:00
class-wc-rate-limiter.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-regenerate-images-request.php prevent regenerate image filter loop 2020-08-25 14:31:15 -03:00
class-wc-regenerate-images.php Improve choice of words 2020-08-25 18:03:03 -03:00
class-wc-register-wp-admin-settings.php Refactor in the WC_Settings_Page class for PHP 8 compatibility 2021-04-13 12:45:42 +02:00
class-wc-rest-authentication.php Merge pull request #27587 from om4james/fix/26847-rest-api-auth 2020-10-08 16:32:03 +05:30
class-wc-rest-exception.php Fixed usage of package tag in REST API and templates 2020-09-17 11:56:08 -03:00
class-wc-session-handler.php Added deprecated notice to nonce_user_logged_out 2021-03-31 19:29:26 -03:00
class-wc-shipping-rate.php Correct function summaries in the WC_Shipping_Rate class 2021-02-12 12:12:27 -05:00
class-wc-shipping-zone.php Replace 'DIRECTORY_SEPARATOR' with '/' 2020-08-26 15:50:34 -05:00
class-wc-shipping-zones.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
class-wc-shipping.php Invert “if” statement to reduce nesting 2020-12-11 08:23:22 +01:00
class-wc-shortcodes.php Revert "Load product category content with content-product-cat.php" 2020-11-23 20:52:27 -03:00
class-wc-structured-data.php Make product name escaping consistent in the front-end 2021-03-30 11:04:44 +02:00
class-wc-tax.php Revert "Fix filter woocommerce_shipping_rate_cost backwards compatibility" 2021-05-14 14:08:30 -07:00
class-wc-template-loader.php Allow block templates for WooCommerce pages 2021-05-31 12:57:47 +02:00
class-wc-tracker.php Merge pull request #30514 from woocommerce/remove/wctracker-admin_user_agent 2021-08-17 15:27:14 +01:00
class-wc-validation.php Fixed Puerto Rico address localization 2020-12-01 16:24:58 -08:00
class-wc-webhook.php Add a 'NumberUtil' class with a 'round' method. 2020-10-01 11:08:51 +02:00
class-woocommerce.php Prep versions for trunk 2021-08-19 13:38:14 -07:00
wc-account-functions.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
wc-attribute-functions.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
wc-cart-functions.php Merge pull request #28064 from woocommerce/fix/27087 2020-10-29 17:55:02 -03:00
wc-conditional-functions.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
wc-core-functions.php Simplied fix per comment 2021-06-29 06:41:16 -07:00
wc-coupon-functions.php Fix docblock summary for wc_get_coupon_id_by_code 2020-08-22 22:20:12 +02:00
wc-deprecated-functions.php add/update correct deprecated notices on existing deprecations 2020-07-16 17:13:08 -03:00
wc-formatting-functions.php task: revise docblock for wc_format_decimal() 2021-07-01 17:41:33 +05:30
wc-notice-functions.php remove duplicate apply_filter 2020-08-21 11:36:03 +03:00
wc-order-functions.php Add to the restock_refunded_items count instead of replacting 2021-04-27 07:22:28 -07:00
wc-order-item-functions.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
wc-page-functions.php support overriding/customising password reset page title via `action`: 2020-10-14 09:50:36 +13:00
wc-product-functions.php Allow user with capabilities to view downloadable image closes #29988 2021-07-29 08:19:35 -07:00
wc-rest-functions.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
wc-stock-functions.php Use int cast instead of intval in wc_get_low_stock_amount 2021-04-20 16:35:42 +02:00
wc-template-functions.php Fix product search block not actually working. 2021-07-19 16:51:13 +02:00
wc-template-hooks.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
wc-term-functions.php Convert to using internal DI container 2021-04-16 12:23:40 -07:00
wc-update-functions.php Add docblock 2021-08-19 10:10:00 -07:00
wc-user-functions.php Merge pull request #27352 from juliquiron/fix/slow-wc-customer-get-operations 2020-12-14 09:43:04 +05:30
wc-webhook-functions.php Fixed package tag usage 2020-08-05 13:36:24 -03:00
wc-widget-functions.php Fixed package tag usage 2020-08-05 13:36:24 -03: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.