18 lines
429 B
PHP
18 lines
429 B
PHP
<?php
|
|
|
|
if( ! defined( 'ABSPATH' ) ){
|
|
exit; // Exit if accessed directly.
|
|
}
|
|
|
|
function get_subscription_tier($subscription){
|
|
$tier = '';
|
|
foreach ( $subscription->get_items() as $line_item ) {
|
|
$product_id = $line_item['product_id'];
|
|
$is_core_product = get_field('subscription_type', $product_id) === 'core';
|
|
|
|
if($is_core_product){
|
|
$tier = get_field('subscription_tier', $product_id);
|
|
}
|
|
}
|
|
return $tier;
|
|
} |