Set Inventory Limit by Custom Field
This filter sets the inventory of an Advanced resource dynamically based on the inventory custom field of the post/page on which the form is embedded.
Instructions
See “Where do I put snippets?” in our documentation for installation instructions.
Code
Filename: gpi-set-inventory-limit-by-custom-field.php
Can you expand on how this works please, I’ve added the snippet but nothing seems to be happening. Do you need to select Inventory “Advanced” and add a scope ? or do you leave all unset and this just works – sorry I’m confused.
Hi Kenny,
The way it works is that you’ll need to update ‘inventory’ as commented in the code to match your meta key of the custom field with the inventory limit value. Then, you’ll need to set your Inventory type to Advanced and set up a Resource. A scope is not needed here. This snippet sets the inventory of an Advanced resource dynamically based on the value of the custom field.
I hope this helps. However, if it’s still not working for you, send us a message via our support form so we can look into this on your end.
Best,