HEX
Server: Apache/2
System: Linux s01 6.1.0-34-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.135-1 (2025-04-25) x86_64
User: beestg (1003)
PHP: 8.3.25
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/beestg/public_html/wp-content/plugins/tiktok-for-business/utils/utilities.php
<?php
/**
 * Copyright (c) Bytedance, Inc. and its affiliates. All Rights Reserved
 *
 * This source code is licensed under the license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @package TikTok
 */

require_once 'Method.php';

if ( ! defined( 'ABSPATH' ) ) {
	die;
}

/**
 * Determine variation product ID for TT catalog sync
 *
 * @param int    $method     Method const int from abstract util Class Method.
 * @param string $parent_id  parent product's sku_id.
 * @param string $sku_id     variation product's sku_id.
 * @param string $product_id variation product's WP DB ID.
 *
 * @return string
 */
function variation_content_id_helper( $method, $parent_id, $sku_id, $product_id ) {
	if ( METHOD::CATALOG == $method || Method::DELETE == $method || Method::PURCHASE == $method ) {
		if ( $sku_id == $parent_id ) {
			$sku_id = $parent_id . '-' . $product_id;
		}
		return $sku_id;
	} elseif ( Method::ADDTOCART == $method || Method::STARTCHECKOUT == $method ) {
		$content_id = $sku_id;
		if ( $sku_id == $parent_id ) {
			$content_id = $parent_id . '-' . $product_id;
		}
		return $content_id;
	} else {
		return $sku_id;
	}
}