pre store read

apply_filters( 'floorplan_store_read',
array $store,
int $floorplan_id,
array $elements );

Filters the store values of a floorplan for each view and when opening in the builder.


(array) The store data values of each element the floorplan.
(int) The floorplan ID.
(array) The other properties of each element.



More Information

This filter can be used to import store data, e.g. availability or price, into a floorplan. The next time a floorplan is saved in the builder, these values will be permanent.

For most values there is also a property (bool) canedit, which can be used to restrict the ability to overwrite the value in the builder while still being shown in the sidepanel. This property is not saved.

This code should be implemented in PHP. For extra guidance, please see WPBeginner’s tutorial on adding custom code.


function my_floorplan_store_read( $store,  $floorplan_id, $elements ){

	foreach( $store as $element_id => $values ){

		// get the price from your webshop
		// e.g. assuming you are using WooCommerce and
		// you assigned an element to a product:

		if( $values['identity']['value'] === 'assmnt' ){
			$product = wc_get_product( $values['assignment']['value'] );
			if( $product ){
				$store[$element_id]['price']['value']   = $product->get_price();

				// if you don't want to allow the price to be changed in the builder
				$store[$element_id]['price']['canedit'] = false;

	return $store;

add_filter( 'floorplan_store_read', 'my_floorplan_store_read', 10, 3 );
filed under: