Plugin Directory

Changeset 3405965


Ignore:
Timestamp:
11/30/2025 01:47:20 AM (7 weeks ago)
Author:
brightvesseldev
Message:

Tagging version v2.3

Location:
pre-orders-for-woocommerce
Files:
20 added
8 edited
7 copied

Legend:

Unmodified
Added
Removed
  • pre-orders-for-woocommerce/tags/2.3/main.php

    r3390690 r3405965  
    44 * Plugin URI: https://wordpress.org/plugins/pre-orders-for-woocommerce/
    55 * Description: Ultimate Preorders Plugin for WooCommerce.
    6  * Version: 2.2
     6 * Version: 2.3
    77 * Requires PHP: 7.4
    88 * Domain Path: /languages/
    99 * Requires Plugins: woocommerce
    1010 * WC tested up to: 10.3.4
    11  * Tested up to: 6.8.2
     11 * Tested up to: 6.8.3
    1212 * WC requires at least: 5.0
    1313 * Author: Bright Plugins
     
    2929}
    3030define( 'WCPO_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' );
    31 define( 'WCPO_PLUGIN_VER', '2.2' );
     31define( 'WCPO_PLUGIN_VER', '2.3' );
    3232
    3333define( 'PFWBP_ASSETS', plugins_url( '', __FILE__ ) . '/media' );
     
    4040    }
    4141    if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
    42             \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, false );
     42            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
    4343        }
    4444} );
  • pre-orders-for-woocommerce/tags/2.3/readme.txt

    r3390690 r3405965  
    44Tags: preorders,pre order,pre-orders,preorder
    55Requires PHP: 7.4
    6 WC tested up to: 10.1.0
    7 Tested up to: 6.8.2
     6WC tested up to: 10.3.4
     7Tested up to: 6.8.3
    88WC requires at least: 4.0
    9 Stable tag: 2.2
     9Stable tag: 2.3
    1010License: GPLv3
    1111License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    1919In the last 2 years, we have now a whopping 7000+ stores using our plugin. We are very grateful for the community of users and we are always here to help.
    2020
    21 [__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
     21[__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description_wp-org&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
    2222
    2323= What is a Pre-Order plugin for WooCommerce? =
     
    2828
    2929
    30 **This plugin is the lite version of the [Pre-Orders for WooCommerce Pro](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description&utm_campaign=upgrade_pro) plugin. It is packed with several features, but Pro allows for several different types of pre-order buying scenarios.**
     30**This plugin is the lite version of the [Pre-Orders for WooCommerce Pro](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description_wp-org&utm_campaign=upgrade_pro) plugin. It is packed with several features, but Pro allows for several different types of pre-order buying scenarios.**
    3131
    3232### 🌟 Pre-Orders for WooCommerce Free Version Features:
     
    8686Use this mode if you want to only allow your customers to either choose pre-order products or available ones.
    8787
    88 [__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
     88[__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-descriptio_wp-orgn&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
    8989
    9090= CHECK OUT OUR VIDEO DEMO ON HOW THIS WORKS: =
     
    179179
    180180== Changelog ==
     181
     182= 2.3 – 29 Nov 2025 =
     183* New: Stock availability text: 'preorder available' instead of 'in stock' for preorder products - Product page
     184* New: Support for Woo Blocks - Checkout Page
     185* Fixed: Error with WooCommerce Email Previews
    181186
    182187= 2.2 – 05 Nov 2025 =
  • pre-orders-for-woocommerce/tags/2.3/src/Bootstrap.php

    r3201146 r3405965  
    22
    33namespace Woocommerce_Preorders;
     4
     5use Woocommerce_Preorders\Blocks\Checkout\CheckoutBlocks;
     6use Woocommerce_Preorders\Pages\ProductPage;
    47
    58class Bootstrap {
     
    4952        $this->initializeOrder();
    5053        new Elementor();
     54        $this->initializeCheckoutBlocks();
    5155        //error_log( 'cosmSettingsTab' );
     56
     57        ProductPage::init();
    5258    }
    5359   
     
    376382        new Order();
    377383    }
     384
     385    public function initializeCheckoutBlocks() {
     386        new CheckoutBlocks();
     387    }
    378388}
  • pre-orders-for-woocommerce/tags/2.3/src/Checkout.php

    r3201146 r3405965  
    2727        add_action( 'woocommerce_checkout_update_order_meta', [$this, 'managePreOrders'], 10, 2 );
    2828        add_action( 'woocommerce_order_status_changed', [$this, 'emailNotifications'], 10, 4 );
    29         add_filter( 'woocommerce_payment_complete_order_status', [$this, 'setPreroderStatus'], 10, 3 );
     29        add_filter( 'woocommerce_payment_complete_order_status', [$this, 'set_preorder_status'], 10, 3 );
    3030        add_filter( 'woocommerce_billing_fields', [$this, 'addShippingDateField'] );
    3131        // send pre-order emails for payment gateways that utilize webhooks.
     
    5252        return $status;
    5353    }
     54
    5455    /**
    5556     * Set main order status 'pre-ordered' after payment complete
    56      *
    57      * @param  [string] $status
    58      * @param  [int]    $order_id
    59      * @param  [type]   $order
    60      * @return status
    61      */
    62     public function setPreroderStatus( $status, $order_id, $order ) {
    63         /*if ( get_post_meta( $order_id, '_preorder_date', true ) ) {
     57     *
     58     * Improved since 2.3
     59     *
     60     * @param string   $status    Order status.
     61     * @param int      $order_id  Order ID.
     62     * @param WC_Order $this      Order object.
     63     *
     64     * @return string status
     65     */
     66    public function set_preorder_status( $status, $order_id, $order ) {
     67
     68        //...
     69        if( !$order instanceof \WC_Order ){
     70            return $status;
     71        }
     72
     73        //...
     74        if ( !empty( $order->get_meta( '_preorder_date' ) ) ) {
    6475            return 'pre-ordered';
    65         }*/
    66         $order = wc_get_order( $order_id );
    67         if ( $order->get_meta( '_preorder_date' ) ) {
    68             return 'pre-ordered';
    69         }
     76        }
     77
    7078        return $status;
    7179    }
     
    8795    public function sendEmailsWebhookEvents( $order_id, $transaction_id ) {
    8896
     97        //...
     98        $order = wc_get_order( $order_id );
     99
     100        if( !$order instanceof \WC_Order ) {
     101            return;
     102        }
     103
     104        //...
     105        $was_preorder_email_sent = $order->get_meta( '_preorder_email_sent' ) == 1;
     106
     107        if( $was_preorder_email_sent ) {
     108            return;
     109        }
     110
     111        //...
    89112        $payment_methods = array(
    90113            'pay_gateway',
     
    111134            WC()->mailer()->get_emails()['WC_New_Customer_Pre_Order_Email']->trigger( $order_id );
    112135            WC()->mailer()->get_emails()['WC_New_Pre_Order_Email']->trigger( $order_id );
     136
     137            $order->add_meta_data( '_preorder_email_sent', true );
     138            $order->save();
    113139        }
    114140
     
    124150     */
    125151    public function emailNotifications( $order_id, $old_status, $new_status, $order ) {
     152       
     153        //...
     154        $was_preorder_email_sent = $order->get_meta( '_preorder_email_sent' ) == 1;
     155
     156        if( $was_preorder_email_sent ) {
     157            return;
     158        }
     159
    126160        $valid_old_statuses = ( 'pending' == $old_status || 'on-hold' == $old_status || 'failed' == $old_status );
    127161        if ( $valid_old_statuses && is_checkout() && 'pre-ordered' == $new_status ) {
     
    131165            // Send "New Email" notification (to admin)
    132166            WC()->mailer()->get_emails()['WC_New_Pre_Order_Email']->trigger( $order_id );
     167
     168            $order->add_meta_data( '_preorder_email_sent', true );
     169            $order->save();
    133170        }
    134171    }
  • pre-orders-for-woocommerce/tags/2.3/src/Product.php

    r3201146 r3405965  
    2222     */
    2323    public function __construct( $productId, $variableId = 0 ) {
    24         $this->product = wc_get_product( $productId );
    25         if ( 'yes' === get_post_meta( $this->product->get_id(), '_is_pre_order', true ) && new \DateTime( get_post_meta( $this->product->get_id(), '_pre_order_date', true ) ) > new \DateTime() ) {
    26             $this->isPreOrder   = true;
    27             $this->preOrderDate = get_post_meta( $this->product->get_id(), '_preorder_date', true );
    28         } elseif ( 'yes' === get_post_meta( $variableId, '_is_pre_order', true ) && new \DateTime( get_post_meta( $variableId, '_pre_order_date', true ) ) > new \DateTime() ) {
    29             $this->isPreOrder   = true;
    30             $this->preOrderDate = get_post_meta( $variableId, '_preorder_date', true );
     24
     25        try {
     26            $this->product = wc_get_product( $productId );
     27            if ( 'yes' === get_post_meta( $this->product->get_id(), '_is_pre_order', true ) && new \DateTime( get_post_meta( $this->product->get_id(), '_pre_order_date', true ) ) > new \DateTime() ) {
     28                $this->isPreOrder   = true;
     29                $this->preOrderDate = get_post_meta( $this->product->get_id(), '_preorder_date', true );
     30            } elseif ( 'yes' === get_post_meta( $variableId, '_is_pre_order', true ) && new \DateTime( get_post_meta( $variableId, '_pre_order_date', true ) ) > new \DateTime() ) {
     31                $this->isPreOrder   = true;
     32                $this->preOrderDate = get_post_meta( $variableId, '_preorder_date', true );
     33            }
     34        } catch (\Throwable $th) {
     35            //throw $th;
    3136        }
    3237    }
  • pre-orders-for-woocommerce/trunk/main.php

    r3390690 r3405965  
    44 * Plugin URI: https://wordpress.org/plugins/pre-orders-for-woocommerce/
    55 * Description: Ultimate Preorders Plugin for WooCommerce.
    6  * Version: 2.2
     6 * Version: 2.3
    77 * Requires PHP: 7.4
    88 * Domain Path: /languages/
    99 * Requires Plugins: woocommerce
    1010 * WC tested up to: 10.3.4
    11  * Tested up to: 6.8.2
     11 * Tested up to: 6.8.3
    1212 * WC requires at least: 5.0
    1313 * Author: Bright Plugins
     
    2929}
    3030define( 'WCPO_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' );
    31 define( 'WCPO_PLUGIN_VER', '2.2' );
     31define( 'WCPO_PLUGIN_VER', '2.3' );
    3232
    3333define( 'PFWBP_ASSETS', plugins_url( '', __FILE__ ) . '/media' );
     
    4040    }
    4141    if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
    42             \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, false );
     42            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
    4343        }
    4444} );
  • pre-orders-for-woocommerce/trunk/readme.txt

    r3390690 r3405965  
    44Tags: preorders,pre order,pre-orders,preorder
    55Requires PHP: 7.4
    6 WC tested up to: 10.1.0
    7 Tested up to: 6.8.2
     6WC tested up to: 10.3.4
     7Tested up to: 6.8.3
    88WC requires at least: 4.0
    9 Stable tag: 2.2
     9Stable tag: 2.3
    1010License: GPLv3
    1111License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    1919In the last 2 years, we have now a whopping 7000+ stores using our plugin. We are very grateful for the community of users and we are always here to help.
    2020
    21 [__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
     21[__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description_wp-org&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
    2222
    2323= What is a Pre-Order plugin for WooCommerce? =
     
    2828
    2929
    30 **This plugin is the lite version of the [Pre-Orders for WooCommerce Pro](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description&utm_campaign=upgrade_pro) plugin. It is packed with several features, but Pro allows for several different types of pre-order buying scenarios.**
     30**This plugin is the lite version of the [Pre-Orders for WooCommerce Pro](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description_wp-org&utm_campaign=upgrade_pro) plugin. It is packed with several features, but Pro allows for several different types of pre-order buying scenarios.**
    3131
    3232### 🌟 Pre-Orders for WooCommerce Free Version Features:
     
    8686Use this mode if you want to only allow your customers to either choose pre-order products or available ones.
    8787
    88 [__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-description&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
     88[__Documentation__](https://brightplugins.com/docs-category/preorder-for-woocommerce/) | [__Support__](https://brightplugins.com/support/) | [__Upgrade To Pro »__](https://brightplugins.com/product/woocommerce-pre-orders-plugin/?utm_source=wp-org&utm_medium=plugin-descriptio_wp-orgn&utm_campaign=upgrade_pro) | [Upgrade with Club](https://brightplugins.com/product/club-membership/?utm_source=freemium&utm_medium=wp_org_page&utm_campaign=upgrade_club_membership)
    8989
    9090= CHECK OUT OUR VIDEO DEMO ON HOW THIS WORKS: =
     
    179179
    180180== Changelog ==
     181
     182= 2.3 – 29 Nov 2025 =
     183* New: Stock availability text: 'preorder available' instead of 'in stock' for preorder products - Product page
     184* New: Support for Woo Blocks - Checkout Page
     185* Fixed: Error with WooCommerce Email Previews
    181186
    182187= 2.2 – 05 Nov 2025 =
  • pre-orders-for-woocommerce/trunk/src/Bootstrap.php

    r3201146 r3405965  
    22
    33namespace Woocommerce_Preorders;
     4
     5use Woocommerce_Preorders\Blocks\Checkout\CheckoutBlocks;
     6use Woocommerce_Preorders\Pages\ProductPage;
    47
    58class Bootstrap {
     
    4952        $this->initializeOrder();
    5053        new Elementor();
     54        $this->initializeCheckoutBlocks();
    5155        //error_log( 'cosmSettingsTab' );
     56
     57        ProductPage::init();
    5258    }
    5359   
     
    376382        new Order();
    377383    }
     384
     385    public function initializeCheckoutBlocks() {
     386        new CheckoutBlocks();
     387    }
    378388}
  • pre-orders-for-woocommerce/trunk/src/Checkout.php

    r3201146 r3405965  
    2727        add_action( 'woocommerce_checkout_update_order_meta', [$this, 'managePreOrders'], 10, 2 );
    2828        add_action( 'woocommerce_order_status_changed', [$this, 'emailNotifications'], 10, 4 );
    29         add_filter( 'woocommerce_payment_complete_order_status', [$this, 'setPreroderStatus'], 10, 3 );
     29        add_filter( 'woocommerce_payment_complete_order_status', [$this, 'set_preorder_status'], 10, 3 );
    3030        add_filter( 'woocommerce_billing_fields', [$this, 'addShippingDateField'] );
    3131        // send pre-order emails for payment gateways that utilize webhooks.
     
    5252        return $status;
    5353    }
     54
    5455    /**
    5556     * Set main order status 'pre-ordered' after payment complete
    56      *
    57      * @param  [string] $status
    58      * @param  [int]    $order_id
    59      * @param  [type]   $order
    60      * @return status
    61      */
    62     public function setPreroderStatus( $status, $order_id, $order ) {
    63         /*if ( get_post_meta( $order_id, '_preorder_date', true ) ) {
     57     *
     58     * Improved since 2.3
     59     *
     60     * @param string   $status    Order status.
     61     * @param int      $order_id  Order ID.
     62     * @param WC_Order $this      Order object.
     63     *
     64     * @return string status
     65     */
     66    public function set_preorder_status( $status, $order_id, $order ) {
     67
     68        //...
     69        if( !$order instanceof \WC_Order ){
     70            return $status;
     71        }
     72
     73        //...
     74        if ( !empty( $order->get_meta( '_preorder_date' ) ) ) {
    6475            return 'pre-ordered';
    65         }*/
    66         $order = wc_get_order( $order_id );
    67         if ( $order->get_meta( '_preorder_date' ) ) {
    68             return 'pre-ordered';
    69         }
     76        }
     77
    7078        return $status;
    7179    }
     
    8795    public function sendEmailsWebhookEvents( $order_id, $transaction_id ) {
    8896
     97        //...
     98        $order = wc_get_order( $order_id );
     99
     100        if( !$order instanceof \WC_Order ) {
     101            return;
     102        }
     103
     104        //...
     105        $was_preorder_email_sent = $order->get_meta( '_preorder_email_sent' ) == 1;
     106
     107        if( $was_preorder_email_sent ) {
     108            return;
     109        }
     110
     111        //...
    89112        $payment_methods = array(
    90113            'pay_gateway',
     
    111134            WC()->mailer()->get_emails()['WC_New_Customer_Pre_Order_Email']->trigger( $order_id );
    112135            WC()->mailer()->get_emails()['WC_New_Pre_Order_Email']->trigger( $order_id );
     136
     137            $order->add_meta_data( '_preorder_email_sent', true );
     138            $order->save();
    113139        }
    114140
     
    124150     */
    125151    public function emailNotifications( $order_id, $old_status, $new_status, $order ) {
     152       
     153        //...
     154        $was_preorder_email_sent = $order->get_meta( '_preorder_email_sent' ) == 1;
     155
     156        if( $was_preorder_email_sent ) {
     157            return;
     158        }
     159
    126160        $valid_old_statuses = ( 'pending' == $old_status || 'on-hold' == $old_status || 'failed' == $old_status );
    127161        if ( $valid_old_statuses && is_checkout() && 'pre-ordered' == $new_status ) {
     
    131165            // Send "New Email" notification (to admin)
    132166            WC()->mailer()->get_emails()['WC_New_Pre_Order_Email']->trigger( $order_id );
     167
     168            $order->add_meta_data( '_preorder_email_sent', true );
     169            $order->save();
    133170        }
    134171    }
  • pre-orders-for-woocommerce/trunk/src/Product.php

    r3201146 r3405965  
    2222     */
    2323    public function __construct( $productId, $variableId = 0 ) {
    24         $this->product = wc_get_product( $productId );
    25         if ( 'yes' === get_post_meta( $this->product->get_id(), '_is_pre_order', true ) && new \DateTime( get_post_meta( $this->product->get_id(), '_pre_order_date', true ) ) > new \DateTime() ) {
    26             $this->isPreOrder   = true;
    27             $this->preOrderDate = get_post_meta( $this->product->get_id(), '_preorder_date', true );
    28         } elseif ( 'yes' === get_post_meta( $variableId, '_is_pre_order', true ) && new \DateTime( get_post_meta( $variableId, '_pre_order_date', true ) ) > new \DateTime() ) {
    29             $this->isPreOrder   = true;
    30             $this->preOrderDate = get_post_meta( $variableId, '_preorder_date', true );
     24
     25        try {
     26            $this->product = wc_get_product( $productId );
     27            if ( 'yes' === get_post_meta( $this->product->get_id(), '_is_pre_order', true ) && new \DateTime( get_post_meta( $this->product->get_id(), '_pre_order_date', true ) ) > new \DateTime() ) {
     28                $this->isPreOrder   = true;
     29                $this->preOrderDate = get_post_meta( $this->product->get_id(), '_preorder_date', true );
     30            } elseif ( 'yes' === get_post_meta( $variableId, '_is_pre_order', true ) && new \DateTime( get_post_meta( $variableId, '_pre_order_date', true ) ) > new \DateTime() ) {
     31                $this->isPreOrder   = true;
     32                $this->preOrderDate = get_post_meta( $variableId, '_preorder_date', true );
     33            }
     34        } catch (\Throwable $th) {
     35            //throw $th;
    3136        }
    3237    }
Note: See TracChangeset for help on using the changeset viewer.