Table of Contents
Table of Contents
PHP
WooCommerce core generally follows WordPress PHP naming conventions. On top of that, function, class, and hook names should be prefixed. For functions the prefix is wc_
, for classes is WC_
and for hooks is woocommerce_
.
Function name examples:
wc_get_product()
wc_is_active_theme()
Class name examples:
WC_Breadcrumb
WC_Cart
Hook name examples (actions or filters):
woocommerce_after_checkout_validation
woocommerce_get_formatted_order_total
There are however some exceptions which apply to classes defined inside src/
. Within this directory:
- We do not use the
WC_
prefix for class names (the prefix is not needed, because all of the classes in this location live within theAutomattic\WooCommerce
namespace) - Classes are named using the
CamelCase
convention (however, method names should still beunderscore_separated
) - Class files should match the class name and do not need the
class-
prefix (for example, the filename for theStringUtil
class isStringUtil.php
)
JS
WooCommerce core follows WordPress JS naming conventions. As with PHP, function, class, and hook names should be prefixed, but the convention for JS is slightly different, and camelCase is used instead of snake_case. For functions, the prefix is wc
, for classes is WC
and for hooks is woocommerce
.
Function name example:
wcSettings()
Class name example:
WCOrdersTable
Hook name example (actions or filters):
woocommerceTracksEventProperties
CSS and SASS
Contribution
- Set up development environment
- Our Git Flow
- SCSS and JS minification
- Naming conventions
- CSS SASS coding guidelines and naming conventions
- Critical Flows
- API Critical Flows
- String localisation guidelines
- Translating WooCommerce
- Deprecation in core
- Adding Actions and Filters
- Common Issues
- Writing high-quality testing instructions
Release Notes
- Release Testing Instructions
- 3.6.x notes/FAQ
- 2.6.x to 3.0.0 Developer Migration Notes
- Select2 fields not working in 3.0.x
- Thumbnail Image Regeneration in 3.3+
- Customizing image sizes in 3.3+
REST API and CLI
CRUD & Data Descriptions
- Database Description
- CRUD Objects in 3.0
- Order and Order Line Item Data
- Coupon Data
- Customer Data
- Product Data
- Data Stores
Internal APIs
Theming
- Enabling product gallery features (zoom, swipe, lightbox)
- Template File Guidelines for Devs and Theme Authors
Examples / Guides
WooCommerce is an open source commerce platform built for WordPress and lovingly crafted by Automattic and the WooCommerce community 💜. Come and work with us!