Your cart is empty!
Item Overlay
apply_filters_ref_array( 'vikrestaurants_display_takeaway_additem_overlay', string $html, object $order, array &$scripts )
Fires after displaying the details of an item within a popup/overlay.
Description
Trigger hook to let the plugins add custom HTML contents below the take-away item overlay.
The returned HTML will be always displayed after the default contents of the page.
Parameters
- $html
-
(string) The HTML content to render.
- $item
-
(object) The object holding the take-away item details.
- &$scripts
-
(array) Extra javascript scripts can be attached here to benefit of the existing protected functions.
Example
/**
* Trigger event to let the plugins add custom HTML contents at the end
* of the take-away add item overlay.
*
* @param string $html The HTML string to include within the document.
* @param object $item The object holding the item details.
* @param string[] &$scripts Extra scripts to attach.
*/
add_filter('vikrestaurants_display_takeaway_additem_overlay', function($html, $item, &$scripts) {
// attach script here
$scripts[] = "console.log('Script fired!');";
// append custom HTML
return '<code>HTML CODE WILL BE ADDED HERE</code>';
}, 10, 3); Changelog
| Version | Description |
|---|---|
| 1.5.4 | Introduced. |
Last Update: 1 week ago
Helpful?