1. Documentation /
  2. Custom Variables

Custom Variables

WooCommerce Follow-ups is a premium WooCommerce extension. The following is for advanced users, and is provided as an example to help you get started. Actual implementation of these examples falls outside of the WooCommerce.com Support Policy. Out-of-the-box variables are documented here.
Note: This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.
Custom variables are possible using Follow-up Emails. There is also no need to edit the core Follow-up files. In your theme’s functions.php file or a custom plugin file, you can directly use the fue_before_variable_replacements line to register your own variable then the function would look like this: Here is an example of a custom variable to present the license key to users of the Software Add-on plugin: As an example, you can use the $queue_item->order_id to pull the corresponding license key row from the woocommerce_software_licences table like so: $licenses = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$wpdb->prefix}woocommerce_software_licences WHERE order_id = %d", $queue_item->order_id) ); Then loop through the $licenses array if rows were found and compare and check that the $license->software_product_id is correct: Please use these as an example – its actual functionality is not guaranteed.