Changeset 3405965
- Timestamp:
- 11/30/2025 01:47:20 AM (7 weeks ago)
- Location:
- pre-orders-for-woocommerce
- Files:
-
- 20 added
- 8 edited
- 7 copied
-
tags/2.3 (copied) (copied from pre-orders-for-woocommerce/trunk)
-
tags/2.3/main.php (copied) (copied from pre-orders-for-woocommerce/trunk/main.php) (3 diffs)
-
tags/2.3/media/img/fire-icon.svg (copied) (copied from pre-orders-for-woocommerce/trunk/media/img/fire-icon.svg)
-
tags/2.3/media/img/pro-bp-plugins.png (copied) (copied from pre-orders-for-woocommerce/trunk/media/img/pro-bp-plugins.png)
-
tags/2.3/readme.txt (copied) (copied from pre-orders-for-woocommerce/trunk/readme.txt) (5 diffs)
-
tags/2.3/src/Blocks (added)
-
tags/2.3/src/Blocks/Checkout (added)
-
tags/2.3/src/Blocks/Checkout/CheckoutBlocks.php (added)
-
tags/2.3/src/Blocks/Checkout/assets (added)
-
tags/2.3/src/Blocks/Checkout/assets/css (added)
-
tags/2.3/src/Blocks/Checkout/assets/css/preorder-date-picker.css (added)
-
tags/2.3/src/Blocks/Checkout/assets/js (added)
-
tags/2.3/src/Blocks/Checkout/assets/js/preorder-date-picker.js (added)
-
tags/2.3/src/Bootstrap.php (modified) (3 diffs)
-
tags/2.3/src/Checkout.php (modified) (6 diffs)
-
tags/2.3/src/Pages (added)
-
tags/2.3/src/Pages/ProductPage.php (added)
-
tags/2.3/src/Product.php (modified) (1 diff)
-
tags/2.3/src/Settings.php (copied) (copied from pre-orders-for-woocommerce/trunk/src/Settings.php)
-
tags/2.3/vendor/niloys7/remote-admin-notification-client/class-remote-notification-client.php (copied) (copied from pre-orders-for-woocommerce/trunk/vendor/niloys7/remote-admin-notification-client/class-remote-notification-client.php)
-
trunk/main.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/src/Blocks (added)
-
trunk/src/Blocks/Checkout (added)
-
trunk/src/Blocks/Checkout/CheckoutBlocks.php (added)
-
trunk/src/Blocks/Checkout/assets (added)
-
trunk/src/Blocks/Checkout/assets/css (added)
-
trunk/src/Blocks/Checkout/assets/css/preorder-date-picker.css (added)
-
trunk/src/Blocks/Checkout/assets/js (added)
-
trunk/src/Blocks/Checkout/assets/js/preorder-date-picker.js (added)
-
trunk/src/Bootstrap.php (modified) (3 diffs)
-
trunk/src/Checkout.php (modified) (6 diffs)
-
trunk/src/Pages (added)
-
trunk/src/Pages/ProductPage.php (added)
-
trunk/src/Product.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pre-orders-for-woocommerce/tags/2.3/main.php
r3390690 r3405965 4 4 * Plugin URI: https://wordpress.org/plugins/pre-orders-for-woocommerce/ 5 5 * Description: Ultimate Preorders Plugin for WooCommerce. 6 * Version: 2. 26 * Version: 2.3 7 7 * Requires PHP: 7.4 8 8 * Domain Path: /languages/ 9 9 * Requires Plugins: woocommerce 10 10 * WC tested up to: 10.3.4 11 * Tested up to: 6.8. 211 * Tested up to: 6.8.3 12 12 * WC requires at least: 5.0 13 13 * Author: Bright Plugins … … 29 29 } 30 30 define( 'WCPO_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' ); 31 define( 'WCPO_PLUGIN_VER', '2. 2' );31 define( 'WCPO_PLUGIN_VER', '2.3' ); 32 32 33 33 define( 'PFWBP_ASSETS', plugins_url( '', __FILE__ ) . '/media' ); … … 40 40 } 41 41 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 ); 43 43 } 44 44 } ); -
pre-orders-for-woocommerce/tags/2.3/readme.txt
r3390690 r3405965 4 4 Tags: preorders,pre order,pre-orders,preorder 5 5 Requires PHP: 7.4 6 WC tested up to: 10. 1.07 Tested up to: 6.8. 26 WC tested up to: 10.3.4 7 Tested up to: 6.8.3 8 8 WC requires at least: 4.0 9 Stable tag: 2. 29 Stable tag: 2.3 10 10 License: GPLv3 11 11 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 19 19 In 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. 20 20 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) 22 22 23 23 = What is a Pre-Order plugin for WooCommerce? = … … 28 28 29 29 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.** 31 31 32 32 ### 🌟 Pre-Orders for WooCommerce Free Version Features: … … 86 86 Use this mode if you want to only allow your customers to either choose pre-order products or available ones. 87 87 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 n&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) 89 89 90 90 = CHECK OUT OUR VIDEO DEMO ON HOW THIS WORKS: = … … 179 179 180 180 == 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 181 186 182 187 = 2.2 – 05 Nov 2025 = -
pre-orders-for-woocommerce/tags/2.3/src/Bootstrap.php
r3201146 r3405965 2 2 3 3 namespace Woocommerce_Preorders; 4 5 use Woocommerce_Preorders\Blocks\Checkout\CheckoutBlocks; 6 use Woocommerce_Preorders\Pages\ProductPage; 4 7 5 8 class Bootstrap { … … 49 52 $this->initializeOrder(); 50 53 new Elementor(); 54 $this->initializeCheckoutBlocks(); 51 55 //error_log( 'cosmSettingsTab' ); 56 57 ProductPage::init(); 52 58 } 53 59 … … 376 382 new Order(); 377 383 } 384 385 public function initializeCheckoutBlocks() { 386 new CheckoutBlocks(); 387 } 378 388 } -
pre-orders-for-woocommerce/tags/2.3/src/Checkout.php
r3201146 r3405965 27 27 add_action( 'woocommerce_checkout_update_order_meta', [$this, 'managePreOrders'], 10, 2 ); 28 28 add_action( 'woocommerce_order_status_changed', [$this, 'emailNotifications'], 10, 4 ); 29 add_filter( 'woocommerce_payment_complete_order_status', [$this, 'set PreroderStatus'], 10, 3 );29 add_filter( 'woocommerce_payment_complete_order_status', [$this, 'set_preorder_status'], 10, 3 ); 30 30 add_filter( 'woocommerce_billing_fields', [$this, 'addShippingDateField'] ); 31 31 // send pre-order emails for payment gateways that utilize webhooks. … … 52 52 return $status; 53 53 } 54 54 55 /** 55 56 * 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' ) ) ) { 64 75 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 70 78 return $status; 71 79 } … … 87 95 public function sendEmailsWebhookEvents( $order_id, $transaction_id ) { 88 96 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 //... 89 112 $payment_methods = array( 90 113 'pay_gateway', … … 111 134 WC()->mailer()->get_emails()['WC_New_Customer_Pre_Order_Email']->trigger( $order_id ); 112 135 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(); 113 139 } 114 140 … … 124 150 */ 125 151 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 126 160 $valid_old_statuses = ( 'pending' == $old_status || 'on-hold' == $old_status || 'failed' == $old_status ); 127 161 if ( $valid_old_statuses && is_checkout() && 'pre-ordered' == $new_status ) { … … 131 165 // Send "New Email" notification (to admin) 132 166 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(); 133 170 } 134 171 } -
pre-orders-for-woocommerce/tags/2.3/src/Product.php
r3201146 r3405965 22 22 */ 23 23 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; 31 36 } 32 37 } -
pre-orders-for-woocommerce/trunk/main.php
r3390690 r3405965 4 4 * Plugin URI: https://wordpress.org/plugins/pre-orders-for-woocommerce/ 5 5 * Description: Ultimate Preorders Plugin for WooCommerce. 6 * Version: 2. 26 * Version: 2.3 7 7 * Requires PHP: 7.4 8 8 * Domain Path: /languages/ 9 9 * Requires Plugins: woocommerce 10 10 * WC tested up to: 10.3.4 11 * Tested up to: 6.8. 211 * Tested up to: 6.8.3 12 12 * WC requires at least: 5.0 13 13 * Author: Bright Plugins … … 29 29 } 30 30 define( 'WCPO_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' ); 31 define( 'WCPO_PLUGIN_VER', '2. 2' );31 define( 'WCPO_PLUGIN_VER', '2.3' ); 32 32 33 33 define( 'PFWBP_ASSETS', plugins_url( '', __FILE__ ) . '/media' ); … … 40 40 } 41 41 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 ); 43 43 } 44 44 } ); -
pre-orders-for-woocommerce/trunk/readme.txt
r3390690 r3405965 4 4 Tags: preorders,pre order,pre-orders,preorder 5 5 Requires PHP: 7.4 6 WC tested up to: 10. 1.07 Tested up to: 6.8. 26 WC tested up to: 10.3.4 7 Tested up to: 6.8.3 8 8 WC requires at least: 4.0 9 Stable tag: 2. 29 Stable tag: 2.3 10 10 License: GPLv3 11 11 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 19 19 In 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. 20 20 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) 22 22 23 23 = What is a Pre-Order plugin for WooCommerce? = … … 28 28 29 29 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.** 31 31 32 32 ### 🌟 Pre-Orders for WooCommerce Free Version Features: … … 86 86 Use this mode if you want to only allow your customers to either choose pre-order products or available ones. 87 87 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 n&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) 89 89 90 90 = CHECK OUT OUR VIDEO DEMO ON HOW THIS WORKS: = … … 179 179 180 180 == 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 181 186 182 187 = 2.2 – 05 Nov 2025 = -
pre-orders-for-woocommerce/trunk/src/Bootstrap.php
r3201146 r3405965 2 2 3 3 namespace Woocommerce_Preorders; 4 5 use Woocommerce_Preorders\Blocks\Checkout\CheckoutBlocks; 6 use Woocommerce_Preorders\Pages\ProductPage; 4 7 5 8 class Bootstrap { … … 49 52 $this->initializeOrder(); 50 53 new Elementor(); 54 $this->initializeCheckoutBlocks(); 51 55 //error_log( 'cosmSettingsTab' ); 56 57 ProductPage::init(); 52 58 } 53 59 … … 376 382 new Order(); 377 383 } 384 385 public function initializeCheckoutBlocks() { 386 new CheckoutBlocks(); 387 } 378 388 } -
pre-orders-for-woocommerce/trunk/src/Checkout.php
r3201146 r3405965 27 27 add_action( 'woocommerce_checkout_update_order_meta', [$this, 'managePreOrders'], 10, 2 ); 28 28 add_action( 'woocommerce_order_status_changed', [$this, 'emailNotifications'], 10, 4 ); 29 add_filter( 'woocommerce_payment_complete_order_status', [$this, 'set PreroderStatus'], 10, 3 );29 add_filter( 'woocommerce_payment_complete_order_status', [$this, 'set_preorder_status'], 10, 3 ); 30 30 add_filter( 'woocommerce_billing_fields', [$this, 'addShippingDateField'] ); 31 31 // send pre-order emails for payment gateways that utilize webhooks. … … 52 52 return $status; 53 53 } 54 54 55 /** 55 56 * 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' ) ) ) { 64 75 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 70 78 return $status; 71 79 } … … 87 95 public function sendEmailsWebhookEvents( $order_id, $transaction_id ) { 88 96 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 //... 89 112 $payment_methods = array( 90 113 'pay_gateway', … … 111 134 WC()->mailer()->get_emails()['WC_New_Customer_Pre_Order_Email']->trigger( $order_id ); 112 135 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(); 113 139 } 114 140 … … 124 150 */ 125 151 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 126 160 $valid_old_statuses = ( 'pending' == $old_status || 'on-hold' == $old_status || 'failed' == $old_status ); 127 161 if ( $valid_old_statuses && is_checkout() && 'pre-ordered' == $new_status ) { … … 131 165 // Send "New Email" notification (to admin) 132 166 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(); 133 170 } 134 171 } -
pre-orders-for-woocommerce/trunk/src/Product.php
r3201146 r3405965 22 22 */ 23 23 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; 31 36 } 32 37 }
Note: See TracChangeset
for help on using the changeset viewer.