diff --git a/includes/class-yith-wcwl-wishlist.php b/includes/class-yith-wcwl-wishlist.php index debd301..41f2f57 100644 --- a/includes/class-yith-wcwl-wishlist.php +++ b/includes/class-yith-wcwl-wishlist.php @@ -208,6 +208,31 @@ public function current_user_can( $capability = 'view', $current_user = false ) /* === GETTERS === */ + /** + * Returns all data for this wishlist. + * + * @return array + */ + public function get_data() { + $products = $this->get_items(); + + $arr = array(); + if( ! empty( $products ) ) { + foreach( $products as $product ) { + $prod = $product->get_data(); + + if( ! $prod['product_id'] ) { + continue; + } + + $prod['product'] = wc_get_product( $prod['product_id'] )->get_data(); + $arr[] = $prod; + } + } + + return array_merge( $this->data, array('id' => $this->get_id(), 'token' => $this->get_token() ), array( 'products' => $arr ) ); + } + /** * Get wishlist token * diff --git a/init.php b/init.php index 84d9625..91394cf 100644 --- a/init.php +++ b/init.php @@ -1,10 +1,10 @@ YITH WooCommerce Wishlist gives your users the possibility to create, fill, manage and share their wishlists allowing you to analyze their interests and needs to improve your marketing strategies. Get more plugins for your e-commerce on YITH + * Description: Modified by Prionkor for REST API support.YITH WooCommerce Wishlist gives your users the possibility to create, fill, manage and share their wishlists allowing you to analyze their interests and needs to improve your marketing strategies. Get more plugins for your e-commerce on YITH * Version: 3.0.25 - * Author: YITH + * Author: YITH & Prionkor * Author URI: https://yithemes.com/ * Text Domain: yith-woocommerce-wishlist * Domain Path: /languages/