Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robertdevore/6cf96bd878d957c8764dc46316ed3455 to your computer and use it in GitHub Desktop.
Save robertdevore/6cf96bd878d957c8764dc46316ed3455 to your computer and use it in GitHub Desktop.
Add your own "In Stock" message to the Dispensary Inventory Management add-on via WP Dispensary
<?php
/** Adds a new version of the In Stock message for each menu type */
add_action( 'wpd_dataoutput_bottom', 'add_wpd_inventory_data', 10 );
function add_wpd_inventory_data() { ?>
<?php if ( ! get_post_meta( get_the_ID(), '_inventory_flowers', true ) ) { } else { ?>
<tr><td><span>In stock:</span></td><td>YES</td></tr>
<?php } ?>
<?php if ( ! get_post_meta( get_the_ID(), '_inventory_concentrates', true ) ) { } else { ?>
<tr><td><span>In stock:</span></td><td>YES</td></tr>
<?php } ?>
<?php if ( ! get_post_meta( get_the_ID(), '_inventory_edibles', true ) ) { } else { ?>
<tr><td><span>In stock:</span></td><td>YES</td></tr>
<?php } ?>
<?php if ( ! get_post_meta( get_the_ID(), '_inventory_prerolls', true ) ) { } else { ?>
<tr><td><span>In stock:</span></td><td>YES</td></tr>
<?php } ?>
<?php if ( ! get_post_meta( get_the_ID(), '_inventory_topicals', true ) ) { } else { ?>
<tr><td><span>In stock:</span></td><td>YES</td></tr>
<?php } ?>
<?php if ( ! get_post_meta( get_the_ID(), '_inventory_clones', true ) ) { } else { ?>
<tr><td><span>In stock:</span></td><td>YES</td></tr>
<?php } ?>
<?php if ( ! get_post_meta( get_the_ID(), '_inventory_seeds', true ) ) { } else { ?>
<tr><td><span>In stock:</span></td><td>YES</td></tr>
<?php } ?>
<?php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment