2021 Q4 Sale BFCM – Free Users Sitewide Banner

  1. Documentation
  2. Codex
  3. Extending

Extending

Articles

  • Extension Translations

    WooCommerce is beginning to translate WooCommerce.com-owned extensions into multiple languages. We will be highlighting the supported languages in a new field on each product page as well as a country flag to identify if the extension works in that location. We have plans to translate WooCommerce owned extensions in 2020 and are starting with Spanish. […]

  • 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 […]

  • Customizing checkout fields using actions and filters

    If you are unfamiliar with code and resolving potential conflicts, we have an extension that can help: WooCommerce Checkout Field Editor. Installing and activating this extension overrides any code below that you try to implement; and you cannot have custom checkout field code in your functions.php file when the extension is activated. Custom code should […]

  • Amazon Pay – REST API

    Pay with Amazon as of version 1.6.0 exposes some functionalities through REST API. The Pay with Amazon REST API allows you to authorize, capture, and close authorization. The endpoint is /wp-json/wc/v1/orders/<order_id>/amazon-payments-advanced/. List of orders paid via Amazon Pay There’s no custom endpoint to retrieve list of orders paid via Amazon Pay. The built-in orders point can be […]

  • 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 […]

  • 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 […]

  • Adding a Section to a Settings Tab

    When you’re adding building an extension for WooCommerce that requires settings of some kind, it’s important to ask yourself: Where do they belong? If your extension just has a couple of simple settings, do you really need to create a new tab specifically for it? Most likely the answer is no. When to Create a […]

  • Implementing the WC Integration Class

    If you’re customizing WooCommerce or adding your own functionality to it you’ll probably need a settings page of some sort. One of the easiest ways to create a settings page is by taking advantage of the WC_Integration class. Using the Integration class will automatically create a new settings page under WooCommerce > Settings > Integrations and […]

  • 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 […]

  • Importing WooCommerce Sample Data

    Your store may look empty, right after installing WooCommerce — no products, orders, reviews. This is intentional so you can get started creating your own products and setting up WooCommerce exactly as you need. But maybe you’d like to see what a store full of sample orders and products looks like. If so, we’ve got […]

  • Removing /product/ , /product-category/ , or /shop/ from the URLs

    In sum Removing /product/, /product-category/, or /shop/ from the URLs is not advisable due to the way WordPress resolves its URLs. It uses the product-category (or any other text for that matter) base of an URL to detect that it is an URL leading to a product category. There are SEO plugins that allow you […]

  • 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: […]

  • 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 […]

  • 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: […]

  • Shipping Method API

    WooCommerce has a shipping method API which plugins can use to add their own rates. This article will take you through the steps to creating a new shipping method and interacting with the API. Create a plugin First off, create a regular WordPress/WooCommerce plugin – see  You’ll define your shipping method class in this plugin […]

  • Classes in WooCommerce

    List of Classes in WooCommerce For a list of Classes in WooCommerce, please see the API DOCS. Common Classes WooCommerce The main class is ‘woocommerce’ which is available globally via the $woocommerce variable. This handles the main functions of WooCommerce and init’s other classes, stores site-wide variables, and handles error/success messages. The woocommerce class initializes […]

  • 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, […]

  • Payment Gateway API

    Payment gateways in WooCommerce are class based and can be added through traditional plugins. This guide provides an intro to gateway development. Types of payment gateway Payment gateways come in several varieties: Form based – This is where the user must click a button on a form that then redirects them to the payment processor on the gateway’s […]

WooCommerce - the most customizable eCommerce platform for building your online business.

  • 30 day money back guarantee
  • Support teams across the world
  • Safe & Secure online payment