eab
November 10, 2024, 9:44am
1
Hi there,
I am trying to pre-fill a specific field in the page where new listing’s are created.
This snippet is apparently supposed to do the trick, but isn’t working for me.
add_filter(
'hivepress/v1/models/listing/create',
function($form ) {
if (isset($form['fields']['listing_price'] ) ) {
$form['fields']['listing_price']['default'] = Fr;
}
return $form;
},
1000
);
Did something change?
andrii
November 11, 2024, 1:28pm
4
Hi,
Please use this PHP snippet:
add_action(
'hivepress/v1/models/listing/create',
function($listing_id, $listing) {
$listing->set_price(123)->save_price();
},
1000,
2
);
I hope this is helpful to you.
eab
November 11, 2024, 8:22pm
5
Hi @andrii , thank you for the snippet.
Unfortunately it doesn’t work, but maybe that is because I am trying to pre-fill a text field which is a Listing attribute named ‘listing_price’.
andrii
November 12, 2024, 2:56pm
8
Hi,
I see. Please use this PHP snippet:
add_action(
'hivepress/v1/models/listing/create',
function($listing_id, $listing) {
$listing->set_listing_price(123)->save_listing_price();
},
1000,
2
);
system
Closed
December 12, 2024, 2:56pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.