When using the Default Expire feature in WP Software License for WooCommerce, you may want to adjust the renewal price for licenses. This can be achieved in two different ways, depending on whether you prefer manual control or automation.
Manual adjustment – Each order that generates a license can be updated directly from the WooCommerce admin area. Simply open the order, locate the license details, and change the Renewal Price field. This allows you to set a custom amount for specific customers or orders without affecting others.
Automatic adjustment with custom code – For larger stores or recurring scenarios, the renewal price can be modified programmatically. By adding a small custom snippet, you can set new default renewal pricing rules that apply globally to all future orders. This approach ensures consistency, saves time, and reduces human error.
include_once( 'wp-load.php' );
$UpdateRenewalPriceForProductID = '745';
$UpdateRenewalPriceForVariationD = '0';
$UpdateLicenseGroupID = '0';
$NewUpdatePrice = '3.20';
global $wpdb;
$mysql_query = $wpdb->prepare ( "SELECT
woi1.order_item_id
FROM
" . $wpdb->prefix . "woocommerce_order_itemmeta AS woi1
JOIN " . $wpdb->prefix . "woocommerce_order_itemmeta AS woi2
ON
woi1.order_item_id = woi2.order_item_id
WHERE
woi1.meta_key = '_product_id' AND woi1.meta_value = %s AND woi2.meta_key = '_variation_id' AND woi2.meta_value = %s
GROUP BY
woi1.order_item_id", $UpdateRenewalPriceForProductID, $UpdateRenewalPriceForVariationD );
$results = $wpdb->get_results( $mysql_query );
if ( ! $results )
wp_die ( "No records founds" );
foreach ( $results as $result )
{
$_woo_sl = wc_get_order_item_meta( $result->order_item_id, '_woo_sl', TRUE );
if ( ! is_array ( $_woo_sl ) || ! isset ( $_woo_sl['product_expire_renew_price'] ) || ! isset ( $_woo_sl['product_expire_renew_price'][ $UpdateLicenseGroupID ] ) )
continue;
//Update the price
$_woo_sl['product_expire_renew_price'][ $UpdateLicenseGroupID ] = $NewUpdatePrice;
wc_update_order_item_meta ( $result->order_item_id, '_woo_sl', $_woo_sl );
}
echo "Renewal prices updated";
Both methods give you full flexibility over license renewal pricing while using Default Expire.