PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/rfstoolsupply.com/wp-content/plugins/woozone/melib/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/rfstoolsupply.com/wp-content/plugins/woozone/melib/WooMisc.php

<?php
namespace WooZone\Melib;
defined( 'ABSPATH' ) || exit;

if (class_exists(WooMisc::class) !== true) { class WooMisc {

	//================================================
	//== PUBLIC
	//...

	//================================================
	//== PROTECTED & PRIVATE
	protected static $instance = null;



	//================================================
	//== CONSTRUCTOR
	public static function getInstance() {
		if (is_null(static::$instance)) {
			static::$instance = new self(); //new static();
		}
		return static::$instance;
	}

	protected function __construct() {
	}



	//====================================================================================
	//== PUBLIC
	//====================================================================================

	//================================================
	//== MISC
	public function get_asin_first_variation( $product_id ) {
		$asin = false;
		$_product = wc_get_product( $product_id );
		if ( $_product->is_type( 'variable' ) ){
			
			$variations = $_product->get_available_variations();
			if( isset($variations[0]['variation_id']) ){
				$variation_asin = get_post_meta( $variations[0]['variation_id'], '_amzASIN', true);
				if ( !empty($variation_asin) ) {
					$asin = $variation_asin;
				}
			}
		}

		return $asin;
	}


	//====================================================================================
	//== PROTECTED & PRIVATE
	//====================================================================================

	//================================================
	//== MISC
	//...

} } // end class