Wishlist_Product::get_data()

Summary

Return current product data(price, sku, etc) list


Return

(array)


Source

File: src/BigCommerce/Templates/Wishlist_Product.php

	public function get_data() {
		/** @var Product $product */
		$product = $this->options[ self::PRODUCT ];
		/** @var Wishlist $wishlist */
		$wishlist = $this->options[ self::WISHLIST ];
		$post_id  = $product->post_id();

		$data = [
			self::PRODUCT    => $product,
			self::WISHLIST   => $wishlist,
			self::TITLE      => $post_id ? get_the_title( $post_id ) : $product['name'],
			self::IMAGE      => $this->get_featured_image( $product, $this->options[ self::ATTRIBUTES ] ),
			Brand::NAME      => $this->get_terms( $post_id, Brand::NAME ),
			Condition::NAME  => ( $post_id && has_term( Flag::SHOW_CONDITION, Flag::NAME, $post_id ) ) ? $this->get_terms( $post_id, Condition::NAME ) : [],
			self::PRICE      => $product->calculated_price_range(),
			self::SKU        => $product->sku(),
			self::PERMALINK  => $post_id ? get_the_permalink( $post_id ) : '',
			self::DELETE     => $wishlist->delete_item_url( $product->bc_id() ),
			self::ATTRIBUTES => '',
		];

		return $data;
	}

User Contributed Notes

You must log in before being able to contribute a note or feedback.