Changeset 3275097
- Timestamp:
- 04/16/2025 07:37:46 PM (12 months ago)
- Location:
- engagebay-woocommerce-addon
- Files:
-
- 4 edited
-
tags/4.2.1/actions/class-engagebay-wc-frontend-actions.php (modified) (1 diff)
-
tags/4.2.1/classes/class-engagebay-wc.php (modified) (1 diff)
-
trunk/actions/class-engagebay-wc-frontend-actions.php (modified) (1 diff)
-
trunk/classes/class-engagebay-wc.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
engagebay-woocommerce-addon/tags/4.2.1/actions/class-engagebay-wc-frontend-actions.php
r3274076 r3275097 48 48 public function engagebay_wc_user_update( $customer_id, $updated_properties ) { 49 49 EngageBay_WC_Api::sync_contact( $this->prepare_contact_properties_by_customer_id( $customer_id ) ); 50 } 51 52 public function engagebay_wc_api_checkout_order_processed($order) { 53 // Ensure the order is valid 54 if ($order instanceof WC_Order) { 55 // Get the order ID 56 $order_id = $order->get_id(); 57 58 // Construct $posted_data (approximate form data from the order) 59 $posted_data = [ 60 'billing_first_name' => $order->get_billing_first_name(), 61 'billing_last_name' => $order->get_billing_last_name(), 62 'billing_company' => $order->get_billing_company(), 63 'billing_address_1' => $order->get_billing_address_1(), 64 'billing_address_2' => $order->get_billing_address_2(), 65 'billing_city' => $order->get_billing_city(), 66 'billing_state' => $order->get_billing_state(), 67 'billing_postcode' => $order->get_billing_postcode(), 68 'billing_country' => $order->get_billing_country(), 69 'billing_email' => $order->get_billing_email(), 70 'billing_phone' => $order->get_billing_phone(), 71 'shipping_first_name' => $order->get_shipping_first_name(), 72 'shipping_last_name' => $order->get_shipping_last_name(), 73 'shipping_company' => $order->get_shipping_company(), 74 'shipping_address_1' => $order->get_shipping_address_1(), 75 'shipping_address_2' => $order->get_shipping_address_2(), 76 'shipping_city' => $order->get_shipping_city(), 77 'shipping_state' => $order->get_shipping_state(), 78 'shipping_postcode' => $order->get_shipping_postcode(), 79 'shipping_country' => $order->get_shipping_country(), 80 'payment_method' => $order->get_payment_method(), 81 'order_comments' => $order->get_customer_note() 82 ]; 83 84 // Trigger the legacy checkout order processed hook with three arguments 85 do_action('woocommerce_checkout_order_processed', $order_id, $posted_data, $order); 86 } 50 87 } 51 88 -
engagebay-woocommerce-addon/tags/4.2.1/classes/class-engagebay-wc.php
r3274076 r3275097 157 157 if ( $this->engagebay_wc_option_checked( 'engagebay_wc_sync_orders' ) ) { 158 158 add_action( 'woocommerce_checkout_order_processed', array( $this->frontend_actions, 'engagebay_wc_checkout_order_processed' ), 10, 3 ); 159 add_action( 'woocommerce_store_api_checkout_order_processed', array( $this->frontend_actions, 'engagebay_wc_api_checkout_order_processed' ), 10, 1 ); 159 160 } 160 161 -
engagebay-woocommerce-addon/trunk/actions/class-engagebay-wc-frontend-actions.php
r2577308 r3275097 48 48 public function engagebay_wc_user_update( $customer_id, $updated_properties ) { 49 49 EngageBay_WC_Api::sync_contact( $this->prepare_contact_properties_by_customer_id( $customer_id ) ); 50 } 51 52 public function engagebay_wc_api_checkout_order_processed($order) { 53 // Ensure the order is valid 54 if ($order instanceof WC_Order) { 55 // Get the order ID 56 $order_id = $order->get_id(); 57 58 // Construct $posted_data (approximate form data from the order) 59 $posted_data = [ 60 'billing_first_name' => $order->get_billing_first_name(), 61 'billing_last_name' => $order->get_billing_last_name(), 62 'billing_company' => $order->get_billing_company(), 63 'billing_address_1' => $order->get_billing_address_1(), 64 'billing_address_2' => $order->get_billing_address_2(), 65 'billing_city' => $order->get_billing_city(), 66 'billing_state' => $order->get_billing_state(), 67 'billing_postcode' => $order->get_billing_postcode(), 68 'billing_country' => $order->get_billing_country(), 69 'billing_email' => $order->get_billing_email(), 70 'billing_phone' => $order->get_billing_phone(), 71 'shipping_first_name' => $order->get_shipping_first_name(), 72 'shipping_last_name' => $order->get_shipping_last_name(), 73 'shipping_company' => $order->get_shipping_company(), 74 'shipping_address_1' => $order->get_shipping_address_1(), 75 'shipping_address_2' => $order->get_shipping_address_2(), 76 'shipping_city' => $order->get_shipping_city(), 77 'shipping_state' => $order->get_shipping_state(), 78 'shipping_postcode' => $order->get_shipping_postcode(), 79 'shipping_country' => $order->get_shipping_country(), 80 'payment_method' => $order->get_payment_method(), 81 'order_comments' => $order->get_customer_note() 82 ]; 83 84 // Trigger the legacy checkout order processed hook with three arguments 85 do_action('woocommerce_checkout_order_processed', $order_id, $posted_data, $order); 86 } 50 87 } 51 88 -
engagebay-woocommerce-addon/trunk/classes/class-engagebay-wc.php
r2688120 r3275097 157 157 if ( $this->engagebay_wc_option_checked( 'engagebay_wc_sync_orders' ) ) { 158 158 add_action( 'woocommerce_checkout_order_processed', array( $this->frontend_actions, 'engagebay_wc_checkout_order_processed' ), 10, 3 ); 159 add_action( 'woocommerce_store_api_checkout_order_processed', array( $this->frontend_actions, 'engagebay_wc_api_checkout_order_processed' ), 10, 1 ); 159 160 } 160 161
Note: See TracChangeset
for help on using the changeset viewer.