Reputation: 492
I am iterating through all subscription products that appear because of [products]
shortcode and I want to do a task if the subscription product has n number of trial period days. How can I get this information?
Upvotes: 0
Views: 1481
Reputation: 147
Try this one.
if ( class_exists( 'WC_Subscriptions_Product' ) &&
WC_Subscriptions_Product::get_trial_length( $product_id ) > 0 ) {
//do a thing here
}
Reference: WC_Subscriptions_Product
Upvotes: 1