Gift_Certificate_Balance::render( $attr,  $instance )

Summary

No summary available.

Source

File: src/BigCommerce/Shortcodes/Gift_Certificate_Balance.php

	public function render( $attr, $instance ) {
		if ( ( (bool) get_option( \BigCommerce\Settings\Sections\Gift_Certificates::OPTION_ENABLE, true ) ) == false ) {
			return ''; // render nothing if gift certificates are disabled
		}

		$args = [];
		if ( isset( $_REQUEST[ 'bc-gift-balance' ][ 'code' ] ) ) {
			$code = sanitize_text_field( $_REQUEST[ 'bc-gift-balance' ][ 'code' ] );
			$args = [
				Templates\Gift_Certificate_Balance_Page::CODE    => $code,
				Templates\Gift_Certificate_Balance_Page::BALANCE => $this->get_balance( $code ),
			];
		}
		$controller = Templates\Gift_Certificate_Balance_Page::factory( $args );

		return $controller->render();
	}

User Contributed Notes

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