Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's a working solution, arrived at through some lucky guesses.</p> <pre><code>// check to see if the product is configurable if ( $_product-&gt;getTypeID() == 'configurable' ) { // get the associated products $associatedProducts = $_product-&gt;getTypeInstance()-&gt;getUsedProducts(); // iterate through the products, checking for recurring products foreach ( $associatedProducts as $associatedProduct ) { if ($associatedProduct-&gt;isRecurring()) { // get the recurring profile $profile = $associatedProduct-&gt;getRecurringProfile(); // echo whichever array members you need echo '&lt;p&gt;billed '.$profile['period_frequency'].' time(s) per '.$profile['period_unit'].'&lt;/p&gt;'; } } } </code></pre> <p>I got some help here: <a href="http://www.phptechi.com/how-to-get-associated-child-product.html" rel="nofollow">http://www.phptechi.com/how-to-get-associated-child-product.html</a></p> <p>Then I just made a lucky method-name guess for <code>getRecurringProfile()</code>.</p> <p><code>var_dump($associatedProduct-&gt;getRecurrringProfile())</code> yields:</p> <pre><code>array(13) { ["start_date_is_editable"]=&gt; string(1) "1" ["schedule_description"]=&gt; string(0) "" ["suspension_threshold"]=&gt; string(0) "" ["bill_failed_later"]=&gt; string(1) "1" ["period_unit"]=&gt; string(5) "month" ["period_frequency"]=&gt; string(1) "1" ["period_max_cycles"]=&gt; string(0) "" ["trial_period_unit"]=&gt; string(0) "" ["trial_period_frequency"]=&gt; string(0) "" ["trial_period_max_cycles"]=&gt; string(0) "" ["trial_billing_amount"]=&gt; string(0) "" ["init_amount"]=&gt; string(0) "" ["init_may_fail"]=&gt; string(1) "0" } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload