You can do this by adding the code below to your theme functions.php file
add_filter( "adverts_form_load", "select_default_renewal" );
function select_default_renewal( $form ) {
if( $form["name"] != "advert-renew" ) {
return $form;
}
foreach( $form["field"] as $key => $field) {
if( $field["name"] == "payments_listing_type" ) {
$form["field"][$key]["value"] = 1000;
}
}
return $form;
}
Just replace 1000 with actual ID of renewal pricing you would like to use as a default.
Hi Greg,
After I bought add-on WooCommerce, then there is no preselection for new ad + renewal.
Do I need some new code?
Hi, if you have WC Integration installed please go to wp-admin / Products panel and add or edit a product, now in “Product Data” you should have an option “Renew Listing (WPAdverts)”, this you should be able to use for renewals.
I am using your options, however no preselection appears on the frontend.
Take a look yourself..
https://onlinekursus.dk/onlinekurser-og-onlineuddannelser/add/
Hmm it is possible we are talking about different things :). In the WooCommerce integration you can create Adverts Pricing and Adverts Renewal pricings, the Pricings are being used in [adverts_add] shortcode, the renewals are being used in [adverts_manage] (after clicking “More” / “Renew”).
On the [adverts_add] the renewal options do not show at all.