While adding the currently available docs in, I noticed that there were a few code snippets that have been created over the last few months that highlight how easy it is to customize WPD.
This post will break down 5 code snippets for WP Dispensary that lets you customize your menu beyond the default settings and make your website uniquely yours.
Add “View Details” button to shortcode output
The following code will add a View Details button to the bottom of each item displayed via the shortcodes, similar to how the WooConnect add-on adds view details and buy now buttons.
Remove “In Stock” message from the Inventory Management add-on
Our Inventory Management add-on does a great job of adding the ability to control your inventory management through the backend of your website.
It also does a great job of displaying an “out of stock” message if you have zero stock in for a specific menu item.
What it also does, that some people may not want, is display the inventory amount publicly within the menu item’s Details table.
You may not want to let website visitors see that specific information, so the code below will remove the available inventory from the front end of your website, while still letting you keep track in your dashboard.
Requirements: Dispensary Inventory Management add-on
Add categories to the item details table
While themes like CannaBiz display the menu item’s categories within the theme itself, some may want to have it only displayed in the Details table.
This code snippet will add your menu item’s categories to the bottom of the Details table.
Display your edibles total THC mg per unit
By default, the Details table for each menu item will display the THC mg per serving, and the number of servings per unit. In most cases this is enough info to display.
In other cases, you may find the need to display the total THC mg per unit, and that’s exactly what the code below does.
Add your selected dispensary location(s) to shortcode output
This is a code snippet that utilizes the Dispensary Locations add-on and displays the selected location(s) for each menu item through the included WP Dispensary action hook.
If you have multiple dispensaries or only deliver specific menu items to specific cities, you can utilize this code to display the location name that also links your website visitor to all menu items tagged with that location.
You can add this quick CSS style to the
mylocation class, positioning the name over top of your menu item’s featured image.
Required: Dispensary Locations add-on
More code snippets
You can look through the code snippets section of our documentation which has all of the current code snippets available, and will continue to be updated with new code snippets.