federated-wordpress-customi.../woocommerce/federated_woocommerce_shared_functions.php

14 lines
356 B
PHP
Raw Normal View History

2024-05-02 17:51:32 +00:00
<?php
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;
}