autoship_get_product_recurring_price (function)

( src/products.php ) Retrieves the recurring price for a supplied product. It takes the $product_id, $frequency_type, and $frequency as parameters and returns the recurring price for the Scheduled Order

Function

/**
 * Retrieves the Recurring price for a product.
 *
 * @param int    $product_id.      The WC Product or variation id.
 * @param string $frequency_type.  Optional. The autoship frequency type ( i.e. month, day )
 * @param int    $frequency.       Optional. The autoship frequency duration
 * @return string  The recurring price.
 */
function autoship_get_product_recurring_price( $product_id, $frequency_type = '', $frequency = 0 ) {

  $recurring_price = get_post_meta( $product_id, '_autoship_recurring_price', true );

  // HACK: Check for empty string specifically and return null if empty else value.
  $recurring_price = '' == $recurring_price ? NULL : $recurring_price;

  return apply_filters( 'autoship_recurring_price', $recurring_price, $product_id, $frequency_type, $frequency );

}

Still need help? Contact Us Contact Us