Get help building custom Extensions for WooCommerce.
Docs
-
Settings API
The WooCommerce settings API is used by shipping methods and payment gateways to display, save and load options. Defining form fields You can define your fields using a method called init_form_fields in your constructor: $this->init_form_fields(); You must have your settings defined before you can load them. Define your options like this, setting the form_fields array: […]
-
Upload Files on Product, Cart & Checkout Page in WooCommerce
Customer Upload files for the WooCommerce plugin lets your customer upload files from the product, cart, and checkout page. Installation Configurations At the admin panel, go to WooCommerce > setting > Upload Files to configure the WooCommerce customer upload file extension. In this tab, you will find two sections Add Rule and Manage Rule. Add […]
-
Useful Core Functions
The following useful functions are found in includes/wc-core-functions.php and can be used by themes and plugins. wc_mail Used to send an email using the WooCommerce email templates. wc_mail( $to, $subject, $message, $headers = “Content-Type: text/htmlrn”, $attachments = “” ) wc_get_page_id( $pagename ) Gets a WooCommerce page ID by name, e.g. thankyou wc_get_page_id( $page ) wc_price( $price, […]
-
Using custom attributes in menus and taxonomy archives
Attributes that can be used for the layered nav are a custom taxonomy, which means you can display them in menus, or display products by attributes. This requires some work on your part, and archives must be enabled. Register the taxonomy for menus When registering taxonomies for your custom attributes, WooCommerce calls the following hook: […]
-
Utilizing WooCommerce Icon Font in Extensions
WooCommerce ships with a custom icon font that we use for all the icons in the WooCommerce UI, as of version 2.1. This aids performance and provides pixel perfect clarity on any screen. If you’re building a WooCommerce extension, you may want to use these icons if you’re adding a tab to the product data or […]
-
WC_API – The WooCommerce API Callback
The WooCommerce API allows plugins make a callback to a special URL that will then load the specified class (if it exists) and run an action. This is also useful for gateways that are not initialized. You can view the WC_API class in our docs. Callback URL To trigger the WooCommerce API, you need to use a special […]
-
WooCommerce Hooks: Actions and filters
Introduction: What are hooks? Hooks in WordPress essentially allow you to change or add code without editing core files. They are used extensively throughout WordPress and WooCommerce and are very useful for developers. There are two types of hook: actions and filters. Action Hooks allow you to insert custom code at various points (wherever the hook […]
-
WooCommerce Plugin Developer Handbook
Want to create a plugin to extend WooCommerce? WooCommerce plugins are the same as regular WordPress plugins. For more information, visit Writing a plugin. Your WooCommerce extension should: Adhere to all WordPress plugin coding standards, as well as best practice guidelines for harmonious existence within WordPress and alongside other WordPress plugins. Have a single core […]
-
Developing using WooCommerce CRUD objects
CRUD is an abbreviation of the 4 basic operations you can do to a database or resource – Create, Read, Update, Delete. WooCommerce 3.0 introduced CRUD objects for working with WooCommerce data. Whenever possible it is best-practices to use these objects in your code instead of directly updating metadata or using WordPress post objects. The […]
-
Checklist: Making a Woo Extension GDPR Ready
The General Data Protection Regulation goes into effect on May 25, 2018 and that means that EU residents will have more rights around their privacy, including knowing what data is being collected, stored and shared about them by a website, requesting access to that data, and requesting that all data about them be erase. To […]