WP Manifestindependent plugin directory
manifest / ecommerce / ffl-form-3-automation

Woo ATF Form 3 Generator

This WordPress plugin is designed to help automate filling out Form 3 with customer and dealer info in a WooCommerce order.

by Metrotechs 👾 · github.com/metrotechs/ffl-form-3-automation · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/metrotechs/ffl-form-3-automation/archive/refs/heads/main.zip

Readme

Woo ATF Form 3 Generator

Version: 1.3.0 Requires WordPress: 5.2 or higher Requires WooCommerce: 3.0 or higher (Tested with latest versions) Requires PHP: 7.2 or higher License: GPL v2 or later

Description

The Woo ATF Form 3 Generator is a WordPress plugin designed to streamline the process of creating ATF Form 3 (5320.3) documents for firearm transfers between FFL holders. It automatically populates the form using data from completed WooCommerce orders and configurable plugin settings.

When an order containing items belonging to the 'Supressors' product category (slug: supressors, by default) is set to "Completed" status, this plugin generates a filled ATF Form 3 PDF using your uploaded template and company details.

Features

  • Automatic PDF Generation: Creates ATF Form 3 PDF when a relevant WooCommerce order is marked as "Completed".
  • Category Trigger: Identifies required items based on their assignment to a specific product category (default slug: supressors).
  • Settings Page: Configure plugin options under Settings -> ATF Form 3 Gen.
    • Upload your specific ATF Form 3 PDF template via the WordPress Media Library.
    • Enter your company's (Transferor) details (Name, Address, Phone, Email, FFL, EIN/Class).
    • Select which WooCommerce emails should automatically have the generated PDF attached.
  • Data Integration: Pulls Transferee (receiving FFL dealer) information from order meta data.
  • Item Listing: Populates the form with relevant item details (name, quantity, optional serial number) from the order, filtered by the specified category.
  • PDF Storage: Saves the generated PDF to a dedicated folder within the WordPress uploads directory (wp-content/uploads/atf-form3-generated/).
  • Order Notes: Adds notes to the WooCommerce order indicating success or failure of PDF generation, including a link to the PDF upon success.
  • Email Attachments: Optionally attaches the generated PDF to specified WooCommerce admin and customer emails.

Installation

  1. Download/Clone: Obtain the plugin files (e.g., download ZIP from repository or clone via Git).
  2. Upload: Upload the wc-atf-form3-generator directory to the /wp-content/plugins/ directory of your WordPress installation.
    • Alternatively, upload the ZIP file via Plugins -> Add New -> Upload Plugin.
  3. Install Dependencies:
    • Navigate to the plugin's directory via command line/terminal:
      cd /path/to/your/wordpress/wp-content/plugins/wc-atf-form3-generator/
    • Run Composer to install the required PDF libraries (FPDF & FPDI):
      composer install
    • Note: You need Composer installed on your server or local development environment.
  4. Activate: Activate the plugin through the 'Plugins' menu in WordPress.

Configuration & Usage

  1. Navigate to Settings: Go to Settings -> ATF Form 3 Gen in your WordPress admin area.
  2. Upload Template: Use the "Upload Template PDF" button to select and upload your official ATF Form 3 (5320.3) PDF file. This will be used as the base for filling data.
  3. Enter Transferor Info: Fill in all the fields under "Transferor Information (Your Company)". This data will be used to populate the transferor sections of the form. Name and FFL Number are required for generation.
  4. Configure Email Attachments: Check the boxes for the WooCommerce emails you wish to have the generated PDF automatically attached to.
  5. Save Settings: Click "Save Settings".
  6. Product Setup: Ensure products that require an ATF Form 3 (e.g., suppressors) are assigned to the product category with the slug supressors.
    • Important: If you use a different category slug (e.g., nfa-items), you must update the WC_ATF_FFL_CATEGORY_SLUG constant defined near the top of the main wc-atf-form3-generator.php file to match your category's slug exactly.
  7. FFL Dealer Meta: Ensure that when an order is placed, the selected receiving FFL dealer's information is saved to the order meta data with the key selected_ffl_dealer. This meta value should be an array containing keys like name, address, license_number, ein, class. (The mechanism for selecting and saving this FFL data is outside the scope of this plugin and needs to be handled by your theme or another plugin, like an FFL dealer locator/selector).
  8. Serial Numbers (Optional): If you want serial numbers included on the form, ensure they are saved as order item meta data with the key _serial_number.
  9. Adjust Coordinates (CRITICAL): The placement of text on the PDF depends on X/Y coordinates. You must edit the $coords array within the wc_atf_generate_form_3_pdf function in the file includes/pdf-generator.php to match the layout of your specific template PDF. Use a PDF editor or measurement tool to find the correct coordinates for each field. Incorrect coordinates will result in misplaced text.

Operation

  • When a WooCommerce order containing at least one item belonging to the category defined by WC_ATF_FFL_CATEGORY_SLUG (default: supressors) is marked as "Completed", the plugin checks for the necessary settings (template, transferor info) and FFL dealer data in the order meta.
  • If prerequisites are met, it generates the PDF, saves it to /wp-content/uploads/atf-form3-generated/, adds an order note, saves the file path/URL to order meta (_wc_atf_form3_pdf_path, _wc_atf_form3_pdf_url), and attaches it to the configured emails.

Libraries Used

This plugin relies on the following open-source libraries managed via Composer:

  • FPDF: For basic PDF generation tasks.
  • FPDI: For importing pages from existing PDF documents (the template).

Support

This plugin is provided as-is. For issues or potential enhancements, please refer to the plugin's repository (if applicable) or contact the author. Ensure you have correctly configured settings, set the correct category slug (if not using the default), and adjusted PDF coordinates before seeking support.

Read the full README on GitHub →