apply_filters( 'floorplan_store_write',
array $store,
int $floorplan_id,
bool $update );
Filters the store values of a floorplan when saving in the builder.
Parameters
- $store
- (array) The store data values of each element the floorplan.
- $floorplan_id
- (int) The floorplan ID.
- $update
- (bool) Whether this is an existing floorplan being updated.
Source
floorplans/includes/class‑pro‑floorplans.php
More Information
This filter can be used to export store data, e.g. availability or price when saving a floorplan in the builder.
This code should be implemented in PHP. For extra guidance, please see WPBeginner’s tutorial on adding custom code.
Example
function my_floorplan_store_write( $store, $floorplans_id, $update ){
foreach( $store as $element_id => $values ){
// export price to 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 ){
$price = $store[$element_id]['price']['value'];
$product->set_regular_price( $price );
$product->set_price( $price );
$product->save();
}
}
}
return $store;
}
add_filter( 'floorplan_store_write', 'my_floorplan_store_write', 11, 3);