Function
Checkout flow functions
On this page
- rpress_checkout_fulfilment_first()
- rpress_checkout_flow_reorder_cards()
- rpress_checkout_tip_slot()
- rpress_checkout_flow_adopt_tips()
- rpress_is_order_details_page()
- rpress_checkout_flow_enqueue()
- rpress_order_details_body_class()
- rpress_store_time_format()
- rpress_get_order_eta()
- rpress_order_details_show_guest_note()
Functions for the checkout layout and flow added in RestroPress 3.5.1.
10 functions. Each entry shows the signature, parameters, return value and where it is defined. Functions marked internal are hook callbacks, screen renderers and other plumbing that extensions normally do not call.
rpress_checkout_fulfilment_first()#
Checks whether checkout shows delivery or pickup details before contact details.
True by default; filtered by rpress_checkout_fulfilment_first.
rpress_checkout_fulfilment_first()
Returns bool
Defined in includes/features/checkout-flow/functions.php, line 21.
rpress_checkout_flow_reorder_cards()#
Moves the order details card above the contact card at checkout.
Runs on init and re-hooks rpress_order_details_fields for both the standard and register form paths. Does nothing when rpress_checkout_fulfilment_first() is false.
rpress_checkout_flow_reorder_cards()
Internal. Defined in includes/features/checkout-flow/functions.php, line 44.
rpress_checkout_tip_slot()#
Outputs the tip slot in the payment step when something is hooked to it.
Hooked to rpress_payment_mode_before_gateways_wrap. Fires the rpress_checkout_tip_slot action inside a wrapper element; extensions add their tip picker to that action. Prints nothing when the action has no callbacks.
rpress_checkout_tip_slot()
Note: Echoes output.
Internal. Defined in includes/features/checkout-flow/functions.php, line 73.
rpress_checkout_flow_adopt_tips()#
Moves the RestroPress Tips picker into the checkout tip slot.
Runs on init. Finds priority 12 callbacks whose method is rpress_tips_html_checkout and moves the picker to the rpress_checkout_tip_slot action. If the rpress_checkout_tips_in_payment_step filter returns false, it is added back on rpress_purchase_form_after_user_info instead.
rpress_checkout_flow_adopt_tips()
Internal. Defined in includes/features/checkout-flow/functions.php, line 98.
rpress_is_order_details_page()#
Checks whether the current request shows an order details (receipt) page.
True on the success page or when the current post contains the [rpress_receipt] shortcode. Always false in the admin. Call it after the main query is set up.
rpress_is_order_details_page()
Returns bool
Example
add_action( 'wp_enqueue_scripts', function () {
if ( function_exists( 'rpress_is_order_details_page' ) && rpress_is_order_details_page() ) {
wp_enqueue_script( 'jquery' );
}
} );
Defined in includes/features/checkout-flow/functions.php, line 131.
rpress_checkout_flow_enqueue()#
Enqueues the checkout flow assets on checkout and order details pages.
Runs on wp_enqueue_scripts. The stylesheet loads on both page types; the script loads only on checkout. The rpress_checkout_summary_cards filter sets the script's summary_cards value.
rpress_checkout_flow_enqueue()
Internal. Defined in includes/features/checkout-flow/functions.php, line 148.
rpress_order_details_body_class()#
Adds the rp-order-details-page body class on order details pages.
Callback for the body_class filter, used to hide the theme's page title. Return false from rpress_order_details_hide_page_title to leave the class off.
rpress_order_details_body_class( $classes )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$classes | string[] | Required | Body classes. |
Returns string[]: Body classes.
Internal. Defined in includes/features/checkout-flow/functions.php, line 216.
rpress_store_time_format()#
Returns the PHP time format used to display store service times.
Returns H:i when the store_time_format option is 24hrs, otherwise g:i a.
rpress_store_time_format()
Returns string: PHP date format.
Defined in includes/features/checkout-flow/functions.php, line 236.
rpress_get_order_eta()#
Returns when an order is expected to arrive or be ready.
For ASAP orders, or orders with no stored time, adds a number of minutes to the order's placed time: the upper figure in the stored time text, otherwise the prep_time option, filtered by rpress_order_eta_minutes. Scheduled orders use the stored service date and time. The resulting array is filtered by rpress_order_eta.
rpress_get_order_eta( $payment_id )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$payment_id | int | Required | Order (payment) ID. |
Returns array|null: timestamp (int), label (sentence for the customer), time (display time, with the date if not today), date (empty if today) and asap (bool); null when unknown.
Example
$eta = rpress_get_order_eta( $payment_id );
if ( $eta ) {
echo esc_html( $eta['label'] );
}
Defined in includes/features/checkout-flow/functions.php, line 251.
rpress_order_details_show_guest_note()#
Checks whether to tell a guest on the order details page that the order link was emailed.
True by default when the order has no user account, the visitor is logged out and the order has an email address. Filtered by rpress_order_details_show_guest_note.
rpress_order_details_show_guest_note( $payment_id )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$payment_id | int | Required | Order (payment) ID. |
Returns bool
Defined in includes/features/checkout-flow/functions.php, line 325.
