session->get( '_push_monkey' ); if( $pushmonkey::has_account_key() && $stored_key == null ) { $response = $pushmonkey::$apiClient->create_cart( $key, $api_token ); WC()->session->set( '_push_monkey', $key ); wc_setcookie( '_push_monkey_wc_cart_id', $key, time()+60*60*24*5 ); } return $key; } public function update_cart_hook( $order_id ) { global $woocommerce; $order = new WC_order( $order_id ); $key = get_post_meta( $order_id, '_cart_id', true ); $pushmonkey = new Ocean_Extra_Theme_Panel(); $api_token = $pushmonkey::account_key(); /** * Update cart if key is not empty. */ if( $key != '' ) { $response = $pushmonkey::$apiClient->update_cart( $key, $api_token ); } } public function action_woocommerce_checkout_update_order_meta( $order_id ) { $key = WC()->session->get( '_push_monkey' ); update_post_meta( $order_id, '_cart_id', $key ); wc_setcookie( '_push_monkey_wc_cart_id', '', -1 ); } /** * Private */ function __construct() { $this->add_actions(); } } $push_monkey_wc = new Ocean_Woo_Commerce();