Add extra price to listing attributes

¿Its possible?
I would like to be able to add an extra price option to the attributes of the ad.
In this way:
The advertiser only has to add the price for each attribute when creating the ad

I’ve been stuck trying for more than a day and I can’t!! Any help please?

Hi, it’s not possible yet. But in a previous post someone asked the same question and hivepress said they would consider making this feature available in an update.

It’s a shame, I have few adjustments left to finish and I don’t know what to do

Hi,

You can enable Pricing Extras in the WP Dashboard > HivePress > Settings > Listings section. In that case, sellers will be able to offer extra services (e.g., “extra fast delivery”) for an additional price.

Hi!!
I understand you, but it’s not the solution mate…
The “additional service with extra price” must match the attributes of the liosting.

When the provider makes an listing, he must check the same attributes twice, it’s ridiculous,

It is the only way to match the extra prices (woocommerce) with the extra services (hivepress)

I am looking for a way to directly add a price to each attribute when the seller publishes the ad

If you mean pre-defining extras for sellers and allowing editing the price only (and forbid editing labels or remove extras) unfortunately there’s no such option yet, extras are entirely defined by sellers. There’s a code snippet that allows setting default extras though (for newly created listings) to make it easier for sellers, let me know if this works for you.

Yes please, I need that when for newly created listings, the seller can put a price on each attribute of the listing
In the example I sent you, look at the process:

Please note that this will not prevent sellers from editing extras or removing them, this snippet just adds the default extras for new listings so they don’t have to add extras from scratch.

add_action(
	'hivepress/v1/models/listing/create', 
	function($listing_id, $listing) {
		$listing->set_price_extras([['name' => 'Test', 'price' => 100]])->save_price_extras();
	},
	1000,
	2
);

Thanks for the code, but you did not understand me, I need the seller to be able to add an extra price to the attributes of the listing
Please take a look at the web example that I have sent you, I need the same process to buy a service

Unfortunately there’s no such feature in the current version, this would require a custom implementation. Extras are not linked to attributes, these are implemented as dynamic rows that can be added, edited or removed by vendors for each listings. As mentioned above, the suggested code snippet adds default rows to extras of newly added listings, to make adding extras easier for vendors (e.g. if you have some common extras on your site).

Hello! I have tried to implement the snippet above but unfortunately nothing is being added. Does it perhaps have to define if it’s per item or per booking?

Add a new listing then delete it. Then try and add another new listing, and it will show up on the add listing section.

Where it says test on code, change that to your extra’s title name.

Thank you! The create/delete/create trick worked! I have two extras that I want to add as defaults, but only the one shows up. Do I need to do something different to the second one?

add_action(
	'hivepress/v1/models/listing/create', 
	function($listing_id, $listing) {
		$listing->set_price_extras([['name' => 'Borrower Pick-Up', 'price' => 0]])->save_price_extras();
	},
	1000,
	2
);
add_action(
	'hivepress/v1/models/listing/create', 
	function($listing_id, $listing) {
		$listing->set_price_extras([['name' => 'Borrower Return', 'price' => 0]])->save_price_extras();
	},
	1000,
	2
);

I never learned coding…I tried a few options rearranging the code but it didn’t work and I couldn’t figure out how to add a second price extra to this code.

Hivepress support team, can you help us with this?

Please try this PHP snippet instead

add_action(
	'hivepress/v1/models/listing/create', 
	function($listing_id, $listing) {
		$listing->set_price_extras([['name' => 'Borrower Pick-Up', 'price' => 0], ['name' => 'Borrower Return', 'price' => 0]])->save_price_extras();
	},
	1000,
	2
);
2 Likes

Worked perfectly, thank you!

Can there be an option for extra prices to be filterable so that they appear in the listing attribute filter?

I would like to remove the per day/per booking box, is it possible?
Could you leave it fixed?

Thanks!!!

Ok, the function I need is that the seller can add a price to each attribute when creating a new ad, the function would be similar to creating a variable product in woocommerce and being able to create a product with fixed price and variable price options of the attributes
Can you do it please?
I sent a request days ago to your expert service email, but I have not received a response

Thanks!!

I would like to know if it is possible to assign a reservation time period to each attribute
All of the above can also be solved by changing the Listing page for a woocommerce variable product and adding filterable and indexable attributes to this product,

Is it possible to assign a time period to the ad attribute like in the example?
This time must be deducted from the booking calendar
Example:
" attribute name" “Price” “Time”
cut wood 5$ 1h

Unfortunately there’s no way to switch to WooCommerce products completely since they are used for checkout only, other WooCommerce features are not used in HivePress - it implements its own listings and vendors.

If you enable tiers and extras the functionality is the same to the variable products, customers can choose the base price and none or multiple extras, you can also make some extras required (pre-selected). It’s possible to add any price variations this way, vendors can do this via the listing edit form. Vendors have to add tiers and extras, if you mean pre-defining extras for all listings as attribute fields and using them as extras it may be possible, but this would require customizations.

Sorry for the delay, I replied to the custom request yesterday and will check the inbox within an hour again.