get_settings( 'fcm_server_key' ); if ( ! empty( $fcm_key ) && APPMAKER_WC::$api->get_settings( 'enable_order_push', true )) { $fcm = new Appmaker_WC_FCM_Helper( $fcm_key ); $order = new WC_Order( $orderId ); $user_id = $order->user_id; if ( ! empty( $user_id ) && get_user_meta( $user_id, 'appmaker_wc_user_login_from_app' ) ) { $fcm->setTopic( "user-$user_id" ) ->setMessage( "Order updated #$orderId", "Order status changed to {$order->get_status()}" ) ->setAction( array( 'type' => 'OPEN_ORDER', 'params' => array( 'orderId' => $order->id ) ) ) ->send(); } } } public function hook_stripe_enable_headers() { $output = ' '; echo $output; } public function hook_payment_footer() { $gateway = isset( $_GET['payment_gateway'] ) ? $_GET['payment_gateway'] : ''; $output = ' '; echo $output; } /** * Load the persistent cart make cart sync with app * * @return void|bool */ public function load_persistent_cart(){ global $current_user; if( ! $current_user ) return false; $saved_cart = get_user_meta( $current_user->ID, '_woocommerce_persistent_cart', true ); if ( $saved_cart && is_array( $saved_cart ) && isset( $saved_cart['cart'] ) ){ WC()->session->set('cart', $saved_cart['cart'] ); } return true; } } new APPMAKER_WC_General_hooks();