Plugin Directory

Changeset 3318321


Ignore:
Timestamp:
06/26/2025 02:41:15 PM (8 months ago)
Author:
tsplugins
Message:
  • Added option to enable/disable automatic invoice generation for WooCommerce orders via plugin settings
Location:
invoice-generator/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • invoice-generator/trunk/includes/woo-integration.php

    r3318161 r3318321  
    11<?php
    22
    3 
     3add_action('woocommerce_order_status_completed', 'ingen_generate_invoice_for_order');
    44add_action('woocommerce_admin_order_data_after_order_details', 'ingen_display_invoice_pdf_link');
    55add_action('woocommerce_thankyou', 'ingen_generate_invoice_and_show_link_on_thankyou', 10, 1);
     
    117117    }
    118118}
    119 
  • invoice-generator/trunk/invoice-generator.php

    r3318161 r3318321  
    44 * Plugin URI:        https://oplugins.com
    55 * Description:       Generate invoices and download them as PDFs without a database.
    6  * Version:           1.0.7
     6 * Version:           1.0.8
    77 * Requires at least: 5.2
    88 * Requires PHP:      7.0
     
    1717
    1818require_once INGEN_DIR_PATH . 'includes/generate-invoice-pdf-from-data.php';
    19 require_once INGEN_DIR_PATH . 'includes/woo-integration.php';
     19
     20if (get_option('ingen_enable_woo', true)) {
     21    require_once INGEN_DIR_PATH . 'includes/woo-integration.php';
     22    add_action('woocommerce_order_status_completed', 'ingen_generate_invoice_for_order');
     23}
     24
    2025
    2126add_action('admin_menu', 'ingen_add_admin_menu');
    2227add_action('admin_enqueue_scripts', 'ingen_enqueue_assets');
    2328add_action('wp_ajax_ingen_generate_pdf', 'ingen_generate_pdf');
    24 add_action('woocommerce_order_status_completed', 'ingen_generate_invoice_for_order');
     29add_action('admin_init', 'ingen_register_settings');
    2530
    2631
    2732function ingen_add_admin_menu() {
    2833    add_menu_page('Invoice Generator', 'Invoice Generator', 'manage_options', 'invoice-generator', 'ingen_render_page');
     34    add_submenu_page('invoice-generator', 'Settings', 'Settings', 'manage_options', 'invoice-generator-settings', 'ingen_settings_page');
    2935}
    3036
     
    517523<?php
    518524}
     525
     526function ingen_register_settings() {
     527    register_setting(
     528        'ingen_settings_group',
     529        'ingen_enable_woo',
     530        [
     531            'sanitize_callback' => 'ingen_sanitize_checkbox',
     532            'default'           => true,
     533        ]
     534    );
     535
     536    add_settings_section(
     537        'ingen_main_section',
     538        esc_html__('Settings', 'invoice-generator'),
     539        '__return_false',
     540        'invoice-generator-settings'
     541    );
     542
     543    add_settings_field(
     544        'ingen_enable_woo',
     545        esc_html__('WooCommerce Integration', 'invoice-generator'),
     546        'ingen_enable_woo_render',
     547        'invoice-generator-settings',
     548        'ingen_main_section'
     549    );
     550}
     551
     552function ingen_enable_woo_render() {
     553    $enabled = get_option('ingen_enable_woo', true);
     554    ?>
     555    <label for="ingen_enable_woo">
     556        <input type="checkbox"
     557               id="ingen_enable_woo"
     558               name="ingen_enable_woo"
     559               value="1"
     560               <?php echo checked(1, $enabled, false); ?> />
     561        <?php esc_html_e('Enable automatic invoice generation in WooCommerce', 'invoice-generator'); ?>
     562    </label>
     563    <?php
     564}
     565
     566function ingen_settings_page() {
     567    ?>
     568    <div class="wrap">
     569        <h1><?php esc_html_e('Invoice Generator Settings', 'invoice-generator'); ?></h1>
     570        <form method="post" action="options.php">
     571            <?php
     572            settings_fields('ingen_settings_group');
     573            do_settings_sections('invoice-generator-settings');
     574            submit_button();
     575            ?>
     576        </form>
     577    </div>
     578    <?php
     579}
     580
     581function ingen_sanitize_checkbox($input) {
     582    return $input === '1' ? 1 : 0;
     583}
  • invoice-generator/trunk/readme.txt

    r3318161 r3318321  
    55Tested up to: 6.8
    66Requires PHP: 7.0
    7 Stable tag: 1.0.7
     7Stable tag: 1.0.8
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Generate beautiful PDF invoices from the WordPress admin panel — and with full WooCommerce integration! No database needed — all data is handled in-browser or on the fly.
     11Generate beautiful PDF invoices from WP admin — with optional WooCommerce integration. No database needed, all done on the fly.
    1212
    1313== Description ==
     
    1515**Simple Invoice Generator** is a lightweight, easy-to-use WordPress plugin for generating PDF invoices. It also includes powerful **WooCommerce support**, allowing automatic invoice generation when customers complete an order.
    1616
    17 🎉 **In 1.0.7 — WooCommerce Integration!**
     17🎉 **WooCommerce Integration!**
    1818Automatically generate and attach a PDF invoice when a WooCommerce order is placed (e.g. after checkout or when an order is marked as completed).
    19 You can also view and download the generated invoice directly from the order admin screen.
     19You can **enable or disable automatic invoice generation** from the plugin settings page with a simple checkbox.
     20
     21Also you can view and download the generated invoice directly from the order admin screen.
    2022
    2123### Core features:
     
    5052- The generated invoice uses the order’s billing data, products, prices, currency, and tax details.
    5153
     54🛠️ **Controlling Automatic Invoice Generation**
     55You can toggle the automatic generation of invoices for WooCommerce orders on or off in the plugin settings:
     56
     571. Go to **Invoice Generator > Settings** in the WordPress admin menu.
     582. Find the **WooCommerce Integration** checkbox.
     593. Check it to enable automatic invoice generation, or uncheck to disable.
     604. Save changes.
     61
     62This gives you full control to disable invoice generation if you want to handle invoices manually or with another system.
     63
     64
    5265== Frequently Asked Questions ==
    5366
     
    5770= Is WooCommerce required? =
    5871No, WooCommerce is optional. But if WooCommerce is active, the plugin will auto-enable invoice generation for orders.
     72
     73= Can I disable automatic invoice generation for WooCommerce orders? =
     74Yes! From version 1.0.8 onward, you can toggle this feature in the plugin's Settings page using the WooCommerce Integration checkbox.
     75
    5976
    6077== Screenshots ==
     
    7087
    7188== Changelog ==
     89
     90= 1.0.8 =
     91* Added option to enable/disable automatic invoice generation for WooCommerce orders via plugin settings
    7292
    7393= 1.0.7 =
Note: See TracChangeset for help on using the changeset viewer.