Filter
rpress_product_details_widget_purchase_button
On this page
Filters the purchase button markup in the menu item details widget.
Runs when the widget builds its output and the "show purchase button" option is enabled. The default is the output of rpress_get_purchase_link() for the item. When that option is off the filter does not run.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$purchase_button | string | The purchase link markup. |
$fooditem_id | int | ID of the menu item shown in the widget. |
Return value#
string. The purchase button markup.
Example#
function my_details_widget_button( $purchase_button, $fooditem_id ) {
if ( ! rpress_fooditem_available( $fooditem_id ) ) {
return '';
}
return $purchase_button;
}
add_filter( 'rpress_product_details_widget_purchase_button', 'my_details_widget_button', 10, 2 );
Notes#
The final value is printed through esc_html(), so HTML in the returned string is shown as escaped text.
Source#
Applied in:
includes/widgets.php(line 237), inRPRESS_Product_Details_Widget::widget()
See also#
Was this page helpful?
