Plugin Directory

Changeset 3430475


Ignore:
Timestamp:
01/01/2026 11:23:16 AM (3 months ago)
Author:
nakedcatplugins
Message:

Update to version 7.0 from GitHub

Location:
taxonomy-discounts-woocommerce
Files:
6 added
2 deleted
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • taxonomy-discounts-woocommerce/tags/7.0/includes/class-wc-taxonomy-discounts-webdados.php

    r3404819 r3430475  
    7979        $this->pro_addon_link              = 'https://nakedcatplugins.com/product/taxonomy-term-and-role-based-discounts-for-woocommerce-pro-add-on/';
    8080
    81         // Load textdomain
    82         add_action( 'init', array( &$this, 'set_languages' ) );
    83 
    8481        if ( is_admin() ) {
    8582
     
    110107    public static function plugin_url() {
    111108        return plugins_url( '/', WCTD_FREE_PLUGIN_FILE );
    112     }
    113 
    114     /**
    115      * Load plugin text domain for translations
    116      *
    117      * Loads the plugin's translation files for internationalization support
    118      */
    119     public function set_languages() {
    120         load_plugin_textdomain( 'taxonomy-discounts-woocommerce' );
    121109    }
    122110
     
    716704                ||
    717705                apply_filters( 'tdw_custom_product_loop', false )
    718                 ||
     706                // ||
     707                // Not working if permalinks are enabled for this feed, for example https://wordpress.local/woocommerce_gpf/309edb4b77b4ed20/
     708                // Moved to PRO add-on
    719709                // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    720                 isset( $_GET['woocommerce_gpf'] ) // WooCommerce Google Product Feed - https://woocommerce.com/products/google-product-feed/
     710                // isset( $_GET['woocommerce_gpf'] ) // WooCommerce Google Product Feed - https://woocommerce.com/products/google-product-feed/
    721711            ) {
    722712                if ( $this->debug ) {
     
    912902            if ( count( $discount_rules ) ) {
    913903                foreach ( $cart->cart_contents as $cart_item_key => $cart_item ) {
     904                    // Shop as Client Cart Price Changer compatibility - Set custom price, skip our calculations
     905                    if ( isset( $cart_item['sac_custom_price_to_set'] ) ) {
     906                        WC()->cart->cart_contents[ $cart_item_key ]['data']->set_price( $cart_item['sac_custom_price_to_set'] );
     907                        continue;
     908                    }
     909                    // Go on
    914910                    $applied_rule = false;
    915911                    $_product     = $cart->cart_contents[ $cart_item_key ]['data'];
     
    14581454     */
    14591455    private function discount_information( $location ) {
     1456        global $product;
    14601457        $info           = '';
    14611458        $found          = false;
    14621459        $discount_rules = self::get_discount_rules( true );
     1460        $product_id     = $product->get_id();
    14631461        if ( count( $discount_rules ) ) {
    1464             global $product;
    1465             $product_id = $product->get_id();
    1466             $rule       = self::get_product_applied_rule( $product );
     1462            $rule = self::get_product_applied_rule( $product );
    14671463            if ( ! empty( $rule ) ) {
    14681464                ob_start();
     
    15301526                    <?php
    15311527                }
    1532                 echo wp_kses_post( apply_filters( 'tdw_discount_information_' . $product->get_id(), apply_filters( 'tdw_discount_information', ob_get_clean(), $product, $rule, $location ), $product, $rule, $location ) );
    1533             }
     1528                // Echo passing through filters
     1529                echo wp_kses_post(
     1530                    apply_filters(
     1531                        'tdw_discount_information_' . $product->get_id(),
     1532                        apply_filters(
     1533                            'tdw_discount_information',
     1534                            ob_get_clean(),
     1535                            $product,
     1536                            $rule,
     1537                            $location
     1538                        ),
     1539                        $product,
     1540                        $rule,
     1541                        $location
     1542                    )
     1543                );
     1544            }
     1545        }
     1546        // No rule found - Try to add to non-taxonomy discounts
     1547        if ( ! $found ) {
     1548            // Echo passing through filter
     1549            echo wp_kses_post(
     1550                apply_filters(
     1551                    'tdw_discount_information',
     1552                    '',
     1553                    $product,
     1554                    $rule,
     1555                    $location
     1556                )
     1557            );
    15341558        }
    15351559    }
  • taxonomy-discounts-woocommerce/tags/7.0/taxonomy-discounts-woocommerce.php

    r3404819 r3430475  
    33 * Plugin Name:          Taxonomy/Term and Role based Discounts for WooCommerce
    44 * Description:          "Taxonomy/Term based Discounts for WooCommerce" lets you configure discount/pricing rules for products based on any product taxonomy terms and WordPress user roles
    5  * Version:              6.2
     5 * Version:              7.0-beta.1
    66 * Author:               Naked Cat Plugins (by Webdados)
    77 * Author URI:           https://nakedcatplugins.com
  • taxonomy-discounts-woocommerce/trunk/includes/class-wc-taxonomy-discounts-webdados.php

    r3404819 r3430475  
    7979        $this->pro_addon_link              = 'https://nakedcatplugins.com/product/taxonomy-term-and-role-based-discounts-for-woocommerce-pro-add-on/';
    8080
    81         // Load textdomain
    82         add_action( 'init', array( &$this, 'set_languages' ) );
    83 
    8481        if ( is_admin() ) {
    8582
     
    110107    public static function plugin_url() {
    111108        return plugins_url( '/', WCTD_FREE_PLUGIN_FILE );
    112     }
    113 
    114     /**
    115      * Load plugin text domain for translations
    116      *
    117      * Loads the plugin's translation files for internationalization support
    118      */
    119     public function set_languages() {
    120         load_plugin_textdomain( 'taxonomy-discounts-woocommerce' );
    121109    }
    122110
     
    716704                ||
    717705                apply_filters( 'tdw_custom_product_loop', false )
    718                 ||
     706                // ||
     707                // Not working if permalinks are enabled for this feed, for example https://wordpress.local/woocommerce_gpf/309edb4b77b4ed20/
     708                // Moved to PRO add-on
    719709                // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    720                 isset( $_GET['woocommerce_gpf'] ) // WooCommerce Google Product Feed - https://woocommerce.com/products/google-product-feed/
     710                // isset( $_GET['woocommerce_gpf'] ) // WooCommerce Google Product Feed - https://woocommerce.com/products/google-product-feed/
    721711            ) {
    722712                if ( $this->debug ) {
     
    912902            if ( count( $discount_rules ) ) {
    913903                foreach ( $cart->cart_contents as $cart_item_key => $cart_item ) {
     904                    // Shop as Client Cart Price Changer compatibility - Set custom price, skip our calculations
     905                    if ( isset( $cart_item['sac_custom_price_to_set'] ) ) {
     906                        WC()->cart->cart_contents[ $cart_item_key ]['data']->set_price( $cart_item['sac_custom_price_to_set'] );
     907                        continue;
     908                    }
     909                    // Go on
    914910                    $applied_rule = false;
    915911                    $_product     = $cart->cart_contents[ $cart_item_key ]['data'];
     
    14581454     */
    14591455    private function discount_information( $location ) {
     1456        global $product;
    14601457        $info           = '';
    14611458        $found          = false;
    14621459        $discount_rules = self::get_discount_rules( true );
     1460        $product_id     = $product->get_id();
    14631461        if ( count( $discount_rules ) ) {
    1464             global $product;
    1465             $product_id = $product->get_id();
    1466             $rule       = self::get_product_applied_rule( $product );
     1462            $rule = self::get_product_applied_rule( $product );
    14671463            if ( ! empty( $rule ) ) {
    14681464                ob_start();
     
    15301526                    <?php
    15311527                }
    1532                 echo wp_kses_post( apply_filters( 'tdw_discount_information_' . $product->get_id(), apply_filters( 'tdw_discount_information', ob_get_clean(), $product, $rule, $location ), $product, $rule, $location ) );
    1533             }
     1528                // Echo passing through filters
     1529                echo wp_kses_post(
     1530                    apply_filters(
     1531                        'tdw_discount_information_' . $product->get_id(),
     1532                        apply_filters(
     1533                            'tdw_discount_information',
     1534                            ob_get_clean(),
     1535                            $product,
     1536                            $rule,
     1537                            $location
     1538                        ),
     1539                        $product,
     1540                        $rule,
     1541                        $location
     1542                    )
     1543                );
     1544            }
     1545        }
     1546        // No rule found - Try to add to non-taxonomy discounts
     1547        if ( ! $found ) {
     1548            // Echo passing through filter
     1549            echo wp_kses_post(
     1550                apply_filters(
     1551                    'tdw_discount_information',
     1552                    '',
     1553                    $product,
     1554                    $rule,
     1555                    $location
     1556                )
     1557            );
    15341558        }
    15351559    }
  • taxonomy-discounts-woocommerce/trunk/taxonomy-discounts-woocommerce.php

    r3404819 r3430475  
    33 * Plugin Name:          Taxonomy/Term and Role based Discounts for WooCommerce
    44 * Description:          "Taxonomy/Term based Discounts for WooCommerce" lets you configure discount/pricing rules for products based on any product taxonomy terms and WordPress user roles
    5  * Version:              6.2
     5 * Version:              7.0-beta.1
    66 * Author:               Naked Cat Plugins (by Webdados)
    77 * Author URI:           https://nakedcatplugins.com
Note: See TracChangeset for help on using the changeset viewer.