Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added get_data() function #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions includes/class-yith-wcwl-wishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
6 changes: 3 additions & 3 deletions init.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Plugin Name: YITH WooCommerce Wishlist
* Plugin Name: YITH WooCommerce Wishlist (Modified)
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-wishlist/
* Description: <code><strong>YITH WooCommerce Wishlist</strong></code> 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. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce on <strong>YITH</strong></a>
* Description: Modified by Prionkor for REST API support.<code><strong>YITH WooCommerce Wishlist</strong></code> 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. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce on <strong>YITH</strong></a>
* Version: 3.0.25
* Author: YITH
* Author: YITH & Prionkor
* Author URI: https://yithemes.com/
* Text Domain: yith-woocommerce-wishlist
* Domain Path: /languages/
Expand Down