View_Product_Button::get_data()

Summary

No summary available.

Source

File: src/BigCommerce/Templates/View_Product_Button.php

	public function get_data() {
		if ( empty( $this->options[ self::PRODUCT ] ) ) {
			return [
				self::PRODUCT    => null,
				self::PERMALINK  => '',
				self::LABEL      => '',
				self::ATTRIBUTES => '',
			];
		}
		/** @var Product $product */
		$product = $this->options[ self::PRODUCT ];
		$data    = [
			self::PRODUCT    => $product,
			self::PERMALINK  => get_the_permalink( $product->post_id() ),
			self::LABEL      => $this->options[ self::LABEL ] ?: $this->get_label(),
			self::ATTRIBUTES => $this->build_attribute_string( $this->options[ self::ATTRIBUTES ] ),
		];

		return $data;
	}

User Contributed Notes

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