Skip to content

Commit 5090b76

Browse files
sbassahspivurno
andauthored
Set Inventory Limit by Custom Field
* Set Inventory Limit by Custom Field * Update gpi-set-inventory-limit-by-custom-field.php Co-authored-by: David Smith <david@gravitywiz.com>
1 parent 8b846fa commit 5090b76

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Inventory // Set Inventory Limit by Custom Field
4+
* https://gravitywiz.com/documentation/gravity-forms-inventory/
5+
*
6+
* This filter sets the inventory of an Advanced resource dynamically based on the
7+
* inventory custom field of the post/page on which the form is embedded.
8+
*/
9+
add_filter( 'gpi_inventory_limit_advanced', function() {
10+
// Update 'inventory' to the custom field meta key.
11+
return get_post_meta( get_queried_object_id(), 'inventory', true );
12+
} );

0 commit comments

Comments
 (0)