Plugin Directory

Changeset 3269716


Ignore:
Timestamp:
04/09/2025 01:00:44 PM (12 months ago)
Author:
Marcel-NL
Message:

V.1.1.0 Add the option to send the order price included or excluded vat (you can change this in the settings for this plugin)

Location:
rtdashboards/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rtdashboards/trunk/readme.txt

    r3250124 r3269716  
    44Requires at least: 6.7
    55Tested up to: 6.7
    6 Stable tag: 1.0.1
     6Stable tag: 1.1.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • rtdashboards/trunk/rtdashboards-woocommerce.php

    r3246600 r3269716  
    2424    if (in_array('wc-'.$new_status, $success_statuses)) {
    2525
     26        $price_setting = $options['rtdashboards_price_tax_field'] ?? 'incl_tax';
     27
    2628        // The total amount of the order can be retrieved from the $order object
    27         $order_total = $order->get_total();
     29        $order_total = $price_setting === 'excl_tax'
     30            ? $order->get_total() - $order->get_total_tax()
     31            : $order->get_total();
    2832
    2933        // POST request using WordPress's built-in WP_Http class
  • rtdashboards/trunk/rtdashboards.php

    r3250124 r3269716  
    6464
    6565            add_settings_field(
     66                'rtdashboards_price_tax_field',
     67                __( 'Send Price', 'rtdashboards' ),
     68                array( $this, 'rtdashboards_price_tax_field_render'),
     69                'rtdashboardsPlugin',
     70                'rtdashboards_rtdashboardsPlugin_section'
     71            );
     72
     73            add_settings_field(
    6674                'rtdashboards_successful_order_statuses_field', // Updated field name for clarity
    6775                __( 'Successful WooCommerce Order Statuses', 'rtdashboards' ), // Updated label for clarity
     
    173181            echo '</select>';
    174182        }
     183
     184        function rtdashboards_price_tax_field_render() {
     185
     186            $options = get_option( 'rtdashboards_settings' );
     187            $selected = isset($options['rtdashboards_price_tax_field']) ? $options['rtdashboards_price_tax_field'] : 'incl_tax';
     188            ?>
     189            <select name="rtdashboards_settings[rtdashboards_price_tax_field]">
     190                <option value="incl_tax" <?php selected( $selected, 'incl_tax' ); ?>>
     191                    <?php _e('Include VAT', 'rtdashboards'); ?>
     192                </option>
     193                <option value="excl_tax" <?php selected( $selected, 'excl_tax' ); ?>>
     194                    <?php _e('Exclude VAT', 'rtdashboards'); ?>
     195                </option>
     196            </select>
     197            <p class="description"><?php _e('Determine whether the prices including or excluding VAT are sent to RTDashboards.', 'rtdashboards'); ?></p>
     198            <?php
     199        }
    175200    }
    176201
Note: See TracChangeset for help on using the changeset viewer.