2024-05-02 17:51:32 +00:00
|
|
|
<?php
|
|
|
|
|
2024-10-17 20:39:34 +00:00
|
|
|
if( ! defined( 'ABSPATH' ) ){
|
|
|
|
exit; // Exit if accessed directly.
|
|
|
|
}
|
|
|
|
|
2024-05-02 17:51:32 +00:00
|
|
|
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;
|
|
|
|
}
|