WC_Cart_Session::get_saved_cart()
Get the persistent cart from the database.
Method of the class: WC_Cart_Session{}
Hooks from the method
Return
Array
.
Usage
// private - for code of main (parent) class only $result = $this->get_saved_cart();
Changelog
Since 3.5.0 | Introduced. |
WC_Cart_Session::get_saved_cart() WC Cart Session::get saved cart code WC 9.2.3
private function get_saved_cart() { $saved_cart = array(); if ( apply_filters( 'woocommerce_persistent_cart_enabled', true ) ) { $saved_cart_meta = get_user_meta( get_current_user_id(), '_woocommerce_persistent_cart_' . get_current_blog_id(), true ); if ( isset( $saved_cart_meta['cart'] ) ) { $saved_cart = array_filter( (array) $saved_cart_meta['cart'] ); } } return $saved_cart; }