Skip to content
Docs
Get RestroPress

Function

Orders and payments functions

Updated
On this page

Functions for creating, reading and updating orders (stored as payments), their statuses, notes, totals and delivery details.

102 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_complete_purchase()#

Runs the order completion routine when a payment status changes to publish or processing.

Hooked to rpress_update_payment_status at priority 100. Returns early if the old status is publish, complete or processing, or if the new status is not publish or processing. Otherwise it fires rpress_pre_complete_purchase, records sales and earnings per menu item, clears the service cookies, updates the customer's purchase count and value, increments discount usage, sets the completed date and fires rpress_complete_purchase, then empties the cart. When the rpress_use_after_payment_actions filter returns false it also fires rpress_after_payment_actions immediately.

rpress_complete_purchase( $payment_id, $new_status, $old_status )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.
$new_statusstringRequiredThe new payment status.
$old_statusstringRequiredThe previous payment status.

Note: Hook callback. Change an order's payment status with rpress_update_payment_status() instead of calling this directly.

Internal. Defined in includes/payments/actions.php, line 26.

rpress_schedule_after_payment_action()#

Schedules a one-time WP-Cron event that runs the after-payment actions.

Hooked to rpress_complete_purchase. Schedules rpress_after_payment_scheduled_actions to fire after a delay of 30 seconds, adjustable with the rpress_after_payment_actions_delay filter. Does nothing when the rpress_use_after_payment_actions filter returns false.

rpress_schedule_after_payment_action( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Internal. Defined in includes/payments/actions.php, line 158.

rpress_process_after_payment_actions()#

Fires the after-payment actions once for an order.

Does nothing for an empty ID, or when the _rpress_complete_actions_run meta already exists and $force is false. Otherwise it adds an order note, stores the current timestamp in _rpress_complete_actions_run and fires rpress_after_payment_actions with the payment ID.

rpress_process_after_payment_actions( $payment_id = 0, $force = false )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$forceboolfalseRun the actions even if they already ran for this order.

Internal. Defined in includes/payments/actions.php, line 175.

rpress_record_status_change()#

Adds an order note recording a payment status change.

Hooked to rpress_update_payment_status. Translates both statuses to their labels where known and inserts a note in the form "Status changed from X to Y".

rpress_record_status_change( $payment_id, $new_status, $old_status )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.
$new_statusstringRequiredThe new payment status.
$old_statusstringRequiredThe previous payment status.

Internal. Defined in includes/payments/actions.php, line 198.

rpress_clear_user_history_cache()#

Deletes the cached order history of the user who placed an order.

Hooked to rpress_update_payment_status. If the order has a user ID, deletes the rpress_user_{user_id}_purchases transient.

rpress_clear_user_history_cache( $payment_id, $new_status, $old_status )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.
$new_statusstringRequiredThe new payment status.
$old_statusstringRequiredThe previous payment status.

Internal. Defined in includes/payments/actions.php, line 222.

rpress_sync_order_status_on_payment_change()#

Sets the fulfilment status to cancelled when a payment is refunded, cancelled or revoked.

Hooked to rpress_update_payment_status at priority 20. Only acts when the payment status actually changed to refunded, cancelled or revoked and the order is not already cancelled; it then calls rpress_update_order_status() with cancelled.

rpress_sync_order_status_on_payment_change( $payment_id, $new_status, $old_status )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.
$new_statusstringRequiredThe new payment status.
$old_statusstringRequiredThe previous payment status.

Internal. Defined in includes/payments/actions.php, line 243.

rpress_update_old_payments_with_totals()#

Upgrade routine that stores total amounts on payments created before version 1.2.

Verifies the rpress_upgrade_payments_nonce nonce from $data['_wpnonce'], skips if the rpress_payment_totals_upgraded option is set, then loads all payments and saves each total from its stored amount. Sets the option when done. Hooked to rpress_upgrade_payments.

rpress_update_old_payments_with_totals( $data )

Parameters

ParameterTypeDefaultDescription
$dataarrayRequiredRequest data. Must contain _wpnonce.

Internal. Defined in includes/payments/actions.php, line 269.

rpress_mark_abandoned_orders()#

Marks pending orders older than seven days as abandoned.

Runs only inside WP-Cron (it returns early otherwise) and is hooked to rpress_weekly_scheduled_events. Loads pending payments older than one week and sets their status to abandoned.

rpress_mark_abandoned_orders()

Internal. Defined in includes/payments/actions.php, line 300.

rpress_update_payment_backwards_compat()#

Keeps the tax value in sync between the _rpress_payment_meta and _rpress_payment_tax meta keys.

Hooked to updated_postmeta. When either key changes, writes the tax value to the other key with a direct database update and clears the post meta cache. Ignores all other meta keys.

rpress_update_payment_backwards_compat( $meta_id, $object_id, $meta_key, $meta_value )

Parameters

ParameterTypeDefaultDescription
$meta_idintRequiredThe meta row ID that was updated.
$object_idintRequiredThe post ID the meta belongs to.
$meta_keystringRequiredThe meta key that was updated.
$meta_valuemixedRequiredThe new meta value.

Returns int|false|null: Number of rows updated, false on failure, or null when the meta key is not one of the two handled keys or the payment meta has no tax entry.

Internal. Defined in includes/payments/actions.php, line 333.

rpress_cleanup_stats_transients()#

Deletes expired rpress_stats_ transients from the options table.

Removes up to 200 expired rpress_stats_ transients and their timeout rows per run. Hooked to rpress_daily_scheduled_events. Does nothing while WordPress is being installed or set up.

rpress_cleanup_stats_transients()

Internal. Defined in includes/payments/actions.php, line 376.

rpress_recover_payment()#

Resumes an unpaid order from a recovery link and redirects to checkout.

Handles the rpress_recover_payment action using payment_id and payment_key from the query string. The order must be recoverable and the key must match the order's purchase key. If the logged-in state does not match the order's user, it sets an error and redirects to the order history page. Otherwise it empties the cart, re-adds the order's menu items, fees and discounts, stores the order ID in the rpress_resume_payment session value and redirects to checkout with the order's gateway as payment-mode.

rpress_recover_payment()

Note: Ends the request with exit after redirecting.

Internal. Defined in includes/payments/actions.php, line 420.

rpress_recovery_user_mismatch()#

Blocks checkout when a resumed order belongs to a different logged-in user.

Hooked to template_redirect. On the checkout page, if a resumed order (session rpress_resume_payment) has a user ID different from the logged-in user, it empties the cart, sets an error and redirects to the checkout page.

rpress_recovery_user_mismatch()

Internal. Defined in includes/payments/actions.php, line 493.

rpress_recovery_force_login_fields()#

Shows a login prompt on checkout for a resumed order that belongs to a user account.

Hooked to rpress_purchase_form_before_register_login. When a resumed order has a user ID, guest checkout is disabled and the visitor is logged out, it prints a notice with a lost password link and fires rpress_purchase_form_login_fields.

rpress_recovery_force_login_fields()

Note: Echoes output.

Internal. Defined in includes/payments/actions.php, line 515.

rpress_recovery_verify_logged_in()#

Adds a checkout error when a resumed order is submitted by the wrong user.

Hooked to rpress_checkout_error_checks. For a resumed order, sets the recovery_requires_login error if a logged-in user is not the order's user, or if a logged-out visitor submits a different email than an order that belongs to a user account.

rpress_recovery_verify_logged_in( $verified_data, $post_data )

Parameters

ParameterTypeDefaultDescription
$verified_dataarrayRequiredVerified checkout data. Not used.
$post_dataarrayRequiredSubmitted checkout data. Must contain rpress_email.

Internal. Defined in includes/payments/actions.php, line 543.

rpress_sequential_order_number_update()#

Resets the last order number when the sequential order number setting changes.

Hooked to update_option_rpress_settings. When enable_sequential is set and differs from its previous value, sets the rpress_last_payment_number option to null so numbering restarts from the configured start.

rpress_sequential_order_number_update( $old_value, $value )

Parameters

ParameterTypeDefaultDescription
$old_valuearrayRequiredThe previous settings array.
$valuearrayRequiredThe new settings array.

Internal. Defined in includes/payments/actions.php, line 562.

rpress_get_payment()#

Returns the order object for an ID, a post, or a gateway transaction ID.

Accepts an order ID, a WP_Post, or an RPRESS_Payment. With $by_txn true the first argument is treated as a gateway transaction ID and matched against the _rpress_payment_transaction_id meta. Results are cached in the payments object cache group.

rpress_get_payment( $payment_or_txn_id = null, $by_txn = false )

Parameters

ParameterTypeDefaultDescription
$payment_or_txn_idint|string|WP_Post|RPRESS_PaymentnullOrder ID, post or order object, or a transaction ID when $by_txn is true.
$by_txnboolfalseTreat the first argument as a transaction ID.

Returns RPRESS_Payment|false: The order object, or false if the ID is empty or no matching order exists.

Example

$order = rpress_get_payment( 123 );
if ( $order ) {
	echo $order->email;
}

// Look up by gateway transaction ID.
$order = rpress_get_payment( 'txn_abc123', true );

Defined in includes/payments/functions.php, line 27.

rpress_get_payments()#

Queries orders and returns the matching results.

Wraps RPRESS_Payments_Query. The arguments pass through the rpress_get_payments_args filter. The output argument defaults to posts, which returns WP_Post objects; pass rpress_payments to get RPRESS_Payment objects, or fields set to ids for IDs only.

rpress_get_payments( $args = array() )

Parameters

ParameterTypeDefaultDescription
$argsarrayarray()Query arguments, for example number, offset, status, orderby, order, user, output, fields.

Returns array: Matching orders. WP_Post objects by default.

Example

$orders = rpress_get_payments( array(
	'number' => 10,
	'status' => 'publish',
	'output' => 'rpress_payments',
) );
foreach ( $orders as $order ) {
	echo $order->ID;
}

Defined in includes/payments/functions.php, line 76.

rpress_get_payment_by()#

Returns an order looked up by ID, purchase key or order number.

$field is case-insensitive and can be id, key (matches _rpress_payment_purchase_key) or payment_number (matches _rpress_payment_number). Returns false when either argument is empty or the field is not supported.

rpress_get_payment_by( $field = '', $value = '' )

Parameters

ParameterTypeDefaultDescription
$fieldstring''One of id, key, payment_number.
$valuemixed''The value to look up.

Returns RPRESS_Payment|false: The order object, or false if not found.

Example

$order = rpress_get_payment_by( 'key', $purchase_key );

Defined in includes/payments/functions.php, line 93.

rpress_insert_payment()#

Creates an order from prepared payment data and returns its ID.

Builds an RPRESS_Payment from $payment_data (it reads keys such as cart_details, user_info, purchase_key, gateway, currency, status, price, parent and post_date), saves it, fires rpress_insert_payment and sets the order status to pending. If the session holds a recoverable order in rpress_resume_payment, that order is updated instead of creating a new one. The service type, time and date are taken from the service_type, service_time and delivery_date cookies.

rpress_insert_payment( $payment_data = array() )

Parameters

ParameterTypeDefaultDescription
$payment_dataarrayarray()Order data. cart_details and user_info are required.

Returns int|false: The new order ID, or false when $payment_data is empty.

Note: Normally called by the checkout process. Reads the service cookies and the current request, so it is not suited to creating orders from CLI or cron.

Defined in includes/payments/functions.php, line 129.

rpress_maybe_schedule_order_auto_accept()#

Schedules automatic acceptance of a new order when the setting is on.

Hooked to rpress_insert_payment at priority 20. Requires the order_auto_accepted option. Orders paid through online gateways are only scheduled once their status is publish or complete; offline gateways are scheduled immediately. Skips failed, abandoned, refunded, revoked and trashed orders and orders already scheduled. Schedules rpress_order_auto_accept_scheduled after 2 seconds, adjustable with the rpress_order_auto_accept_delay filter.

rpress_maybe_schedule_order_auto_accept( $payment_id = 0, $payment_data = array() )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$payment_dataarrayarray()Order data. May contain status and gateway.

Internal. Defined in includes/payments/functions.php, line 235.

rpress_maybe_schedule_order_auto_accept_on_status_change()#

Schedules auto-accept when a payment status changes to publish or complete.

Hooked to rpress_update_payment_status at priority 20. Calls rpress_maybe_schedule_order_auto_accept() with the new status when it is publish or complete.

rpress_maybe_schedule_order_auto_accept_on_status_change( $payment_id, $new_status, $old_status )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.
$new_statusstringRequiredThe new payment status.
$old_statusstringRequiredThe previous payment status.

Internal. Defined in includes/payments/functions.php, line 280.

rpress_run_order_auto_accept()#

Accepts a pending order when the scheduled auto-accept event fires.

Hooked to rpress_order_auto_accept_scheduled. Requires the order_auto_accepted option and a fulfilment status of pending. Online-gateway orders must have a publish or complete payment status; failed, abandoned, refunded, revoked and trashed orders are skipped. Then sets the order status to accepted with rpress_update_order_status().

rpress_run_order_auto_accept( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Internal. Defined in includes/payments/functions.php, line 294.

rpress_update_payment_status()#

Changes an order's payment status and saves it.

Sets the status on an RPRESS_Payment and saves it. The status change fires rpress_update_payment_status, which in turn runs the completion routine for publish and processing. Returns false if the order does not exist.

rpress_update_payment_status( $payment_id = 0, $new_status = 'publish' )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$new_statusstring'publish'A key from rpress_get_payment_statuses(), for example publish, pending, refunded.

Returns bool: True if the order was saved, false otherwise.

Example

rpress_update_payment_status( 123, 'refunded' );

Note: This is the payment status. The fulfilment status (accepted, ready, completed) is changed with rpress_update_order_status().

Defined in includes/payments/functions.php, line 336.

rpress_delete_purchase()#

Permanently deletes an order and reverses its sales, earnings and customer stats.

Calls rpress_undo_purchase(), decreases total earnings and the customer's purchase count and value when the order status is publish or revoked, removes the order from the customer, deletes the order post (force delete) and its sale log entries, and clears the order status meta. Fires rpress_payment_delete before and rpress_payment_deleted after.

rpress_delete_purchase( $payment_id = 0, $update_customer = true, $delete_fooditem_logs = false )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$update_customerbooltrueUpdate the customer's stats and remove the order from the customer.
$delete_fooditem_logsboolfalseAlso delete the file download logs linked to the order.

Example

rpress_delete_purchase( 123 );

Note: Permanent. There is no capability check and the order cannot be restored.

Defined in includes/payments/functions.php, line 359.

rpress_undo_purchase()#

Reduces menu item earnings and sales counts for the items in an order.

Used when refunding or deleting an order. For each cart item it decreases the menu item's earnings (rpress_decrease_earnings()) and purchase count (rpress_decrease_purchase_count()). Each step can be skipped with the rpress_decrease_earnings_on_undo and rpress_decrease_sales_on_undo filters.

rpress_undo_purchase( $fooditem_id = false, $payment_id = null )

Parameters

ParameterTypeDefaultDescription
$fooditem_idint|falsefalseIgnored. Passing a value triggers a deprecated-argument notice.
$payment_idint|nullnullThe order (payment) ID.

Example

rpress_undo_purchase( false, 123 );

Note: Pass false as the first argument; the value is ignored.

Defined in includes/payments/functions.php, line 425.

rpress_parse_payment_filter_date()#

Converts an admin date filter string to Y-m-d.

Tries the site's date format and several common formats (m/d/Y, n/j/Y, Y-m-d, d/m/Y, j/n/Y, d-m-Y, j-n-Y), then falls back to strtotime().

rpress_parse_payment_filter_date( $date )

Parameters

ParameterTypeDefaultDescription
$datestringRequiredThe date string from an admin filter.

Returns string: The date as Y-m-d, or an empty string if it cannot be parsed.

Internal. Defined in includes/payments/functions.php, line 487.

rpress_count_payments()#

Counts orders grouped by post status.

Builds a query from the arguments and returns an object with one property per registered post status, for example publish and pending. Supported arguments: user, customer, s, start-date, end-date, fooditem, gateway, service-type or service_type, service-date or service_date, order_status and status. A status of paid is treated as publish. Results are cached in the counts object cache group. The query parts can be changed with rpress_count_payments_where and rpress_count_payments_join.

rpress_count_payments( $args = array() )

Parameters

ParameterTypeDefaultDescription
$argsarrayarray()Filter arguments.

Returns object: Object whose properties are post statuses and values are counts.

Example

$counts = rpress_count_payments();
echo (int) $counts->pending;

Note: Returns an object, not an array.

Defined in includes/payments/functions.php, line 535.

rpress_clear_payment_counts_cache()#

Clears cached order counts and earnings figures.

Flushes the counts, rpress and payments object cache groups when supported, calls wp_cache_flush() for the whole object cache, and deletes the earnings transients. Hooked to order insert, status update, delete, refund, trash and untrash events.

rpress_clear_payment_counts_cache( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID. Not used.

Note: Flushes the entire object cache, not only RestroPress entries.

Internal. Defined in includes/payments/functions.php, line 757.

rpress_check_for_existing_payment()#

Checks whether an order exists and has the publish status.

Loads the order and compares its ID strictly to $payment_id, so pass an integer. Orders in any other payment status return false.

rpress_check_for_existing_payment( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns bool: True if the order exists with status publish.

Defined in includes/payments/functions.php, line 802.

rpress_get_payment_status()#

Returns an order's payment status key or label.

Accepts an order ID, WP_Post or RPRESS_Payment. With $return_label true it returns the translated label of the post status. Otherwise it searches the status labels from rpress_get_payment_statuses() for the post status.

rpress_get_payment_status( $payment, $return_label = false )

Parameters

ParameterTypeDefaultDescription
$paymentint|WP_Post|RPRESS_PaymentRequiredOrder ID or object.
$return_labelboolfalseReturn the label instead of the key.

Returns string|false: The status key or label, or false if the order or status is not found.

Example

echo rpress_get_payment_status( 123, true ); // e.g. Paid

Note: Without $return_label, a paid order (post status publish, labelled Paid) is not found because the lookup compares the post status against labels, and the function returns false. Use $return_label = true or the status property of RPRESS_Payment.

Defined in includes/payments/functions.php, line 820.

rpress_get_payment_status_label()#

Returns the label for a payment status key.

rpress_get_payment_status_label( $status = '' )

Parameters

ParameterTypeDefaultDescription
$statusstring''A payment status key.

Returns string|false: The label, or false if the key is unknown.

Defined in includes/payments/functions.php, line 849.

rpress_get_payment_statuses()#

Returns all payment statuses as key => label pairs.

Defaults are pending, publish (Paid), refunded, failed, processing and abandoned. Filterable with rpress_payment_statuses.

rpress_get_payment_statuses()

Returns array: Status keys mapped to translated labels.

Defined in includes/payments/functions.php, line 865.

rpress_get_payment_status_colors()#

Returns the colors used for payment status badges.

Each status has a background color under its key and a text color under the key with a _text suffix. Filterable with rpress_payment_status_colors.

rpress_get_payment_status_colors()

Returns array: Color keys mapped to hex values.

Internal. Defined in includes/payments/functions.php, line 882.

rpress_get_order_status_label()#

Returns the label for a fulfilment status key.

Looks the key up in rpress_get_order_statuses(). The retired out_for_delivery key is treated as transit.

rpress_get_order_status_label( $status = '' )

Parameters

ParameterTypeDefaultDescription
$statusstring''An order status key.

Returns string|false: The label, or false if the key is unknown.

Defined in includes/payments/functions.php, line 905.

rpress_order_status_model()#

Returns the canonical definition of order statuses.

Each status key maps to an array with phase (the customer-facing tracker phase), services (the service types that use the status) and order (its position in the sequence). out_for_delivery is an alias of transit, and failed and refunded map to cancelled. Filterable with rpress_order_status_model.

rpress_order_status_model()

Returns array: Status key => array( phase, services, order ).

Defined in includes/payments/functions.php, line 931.

rpress_order_tracker_steps()#

Returns the ordered customer-facing tracker steps for a service type.

Pickup gets Placed, Confirmed, Preparing, Ready and Picked up. Any other value gets the delivery steps, which add Out for delivery and end at Delivered. Filterable with rpress_order_tracker_steps, which receives the steps and the service type.

rpress_order_tracker_steps( $service_type = 'delivery' )

Parameters

ParameterTypeDefaultDescription
$service_typestring'delivery'delivery or pickup.

Returns array: List of arrays with status and label keys.

Defined in includes/payments/functions.php, line 959.

rpress_order_status_step_index()#

Returns the tracker step index that an order status maps to.

For a status that is not itself a step (for example transit on a pickup order), returns the furthest step whose canonical order does not exceed the status's order. Unknown statuses resolve to 0.

rpress_order_status_step_index( $status, $service_type = 'delivery' )

Parameters

ParameterTypeDefaultDescription
$statusstringRequiredAn order status key.
$service_typestring'delivery'delivery or pickup.

Returns int: Zero-based index into rpress_order_tracker_steps().

Defined in includes/payments/functions.php, line 992.

rpress_get_order_statuses_for_service()#

Returns the order statuses that can be set for a service type.

With an empty $service_type it returns all statuses. Otherwise it removes statuses not used by that service type, for example transit for pickup, according to rpress_order_status_model().

rpress_get_order_statuses_for_service( $service_type = '' )

Parameters

ParameterTypeDefaultDescription
$service_typestring''delivery, pickup, or empty for all.

Returns array: Status key => label.

Defined in includes/payments/functions.php, line 1015.

rpress_get_order_statuses()#

Returns all fulfilment statuses as key => label pairs.

Defaults are pending, accepted, processing, ready, transit, cancelled and completed. Filterable with rpress_order_statuses.

rpress_get_order_statuses()

Returns array: Status keys mapped to translated labels.

Defined in includes/payments/functions.php, line 1036.

rpress_get_order_status_colors()#

Returns the colors used for fulfilment status badges.

Each status has a background color under its key and a text color under the key with a _text suffix. Filterable with rpress_order_status_colors.

rpress_get_order_status_colors()

Returns array: Color keys mapped to hex values.

Internal. Defined in includes/payments/functions.php, line 1054.

rpress_get_payment_status_keys()#

Returns the payment status keys sorted alphabetically.

rpress_get_payment_status_keys()

Returns array: List of status key strings.

Defined in includes/payments/functions.php, line 1081.

rpress_is_payment_complete()#

Checks whether an order's payment status is publish.

Result is filterable with rpress_is_payment_complete, which receives the result, the payment ID and the post status.

rpress_is_payment_complete( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns bool: True if the order exists and has status publish.

Example

if ( rpress_is_payment_complete( $order_id ) ) {
	// Paid.
}

Defined in includes/payments/functions.php, line 1093.

rpress_get_total_sales()#

Returns the number of paid orders.

Adds the revoked and publish counts from rpress_count_payments().

rpress_get_total_sales()

Returns int: Total sales count.

Defined in includes/payments/functions.php, line 1109.

rpress_get_total_earnings()#

Returns the total earnings recorded for the store.

Reads the rpress_earnings_total option. If it is not stored, the total is summed from the _rpress_payment_total meta of publish and revoked orders, cached in a one-day transient and saved to the option. Never negative. Rounded to the currency decimals and filterable with rpress_total_earnings.

rpress_get_total_earnings()

Returns float: Total earnings.

Defined in includes/payments/functions.php, line 1119.

rpress_increase_total_earnings()#

Adds an amount to the stored total earnings.

Updates the rpress_earnings_total option.

rpress_increase_total_earnings( $amount = 0 )

Parameters

ParameterTypeDefaultDescription
$amountfloat|int0Amount to add.

Returns float: The new total.

Note: Called when an order is completed. Calling it manually changes reported totals.

Internal. Defined in includes/payments/functions.php, line 1172.

rpress_decrease_total_earnings()#

Subtracts an amount from the stored total earnings.

Updates the rpress_earnings_total option. The total never goes below zero.

rpress_decrease_total_earnings( $amount = 0 )

Parameters

ParameterTypeDefaultDescription
$amountfloat|int0Amount to subtract.

Returns float: The new total.

Note: Called when an order is deleted. Calling it manually changes reported totals.

Internal. Defined in includes/payments/functions.php, line 1185.

rpress_get_payment_meta()#

Returns post meta for an order.

Delegates to RPRESS_Payment::get_meta(). The default key _rpress_payment_meta returns the order's meta array (empty array if none).

rpress_get_payment_meta( $payment_id = 0, $meta_key = '_rpress_payment_meta', $single = true )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.
$meta_keystring'_rpress_payment_meta'The meta key.
$singlebooltrueReturn a single value (true) or an array of values (false).

Returns mixed: The meta value.

Example

$service_type = rpress_get_payment_meta( 123, '_rpress_delivery_type', true );

Defined in includes/payments/functions.php, line 1203.

rpress_update_payment_meta()#

Updates a meta value on an order.

Delegates to RPRESS_Payment::update_meta().

rpress_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$meta_keystring''The meta key.
$meta_valuemixed''The new value.
$prev_valuemixed''Only update the row with this previous value.

Returns mixed: Meta ID or true on success, false on failure.

Example

rpress_update_payment_meta( 123, '_my_plugin_flag', 'yes' );

Defined in includes/payments/functions.php, line 1215.

rpress_get_payment_meta_user_info()#

Returns the customer info stored on an order.

rpress_get_payment_meta_user_info( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns array: User info array (for example first_name, last_name, email, id, discount).

Defined in includes/payments/functions.php, line 1226.

rpress_get_payment_meta_fooditems()#

Returns the menu items stored on an order.

rpress_get_payment_meta_fooditems( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns array: The order's menu items array.

Defined in includes/payments/functions.php, line 1237.

rpress_get_payment_meta_cart_details()#

Returns the cart line items of an order.

Adds the order currency to each line and sets subtotal for older orders that lack it. With $include_bundle_files true, items of type bundle are followed by lines for their bundled products. Filterable with rpress_payment_meta_cart_details.

rpress_get_payment_meta_cart_details( $payment_id, $include_bundle_files = false )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.
$include_bundle_filesboolfalseAppend the products of bundle items.

Returns array: Cart detail lines.

Defined in includes/payments/functions.php, line 1249.

rpress_get_payment_user_email()#

Returns the customer email address of an order.

rpress_get_payment_user_email( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns string: Email address.

Defined in includes/payments/functions.php, line 1298.

rpress_is_guest_payment()#

Checks whether an order was placed without a user account.

True when the order has no user ID. Filterable with rpress_is_guest_payment.

rpress_is_guest_payment( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns bool: True for guest orders.

Defined in includes/payments/functions.php, line 1309.

rpress_get_payment_user_id()#

Returns the user ID linked to an order.

rpress_get_payment_user_id( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns int|string: The user ID. Empty or 0 for guest orders.

Defined in includes/payments/functions.php, line 1321.

rpress_get_payment_customer_id()#

Returns the RestroPress customer ID linked to an order.

rpress_get_payment_customer_id( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns int|string: The customer ID.

Defined in includes/payments/functions.php, line 1332.

rpress_payment_has_unlimited_fooditems()#

Returns the unlimited menu items flag of an order.

rpress_payment_has_unlimited_fooditems( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns bool: Value of the has_unlimited_fooditems property.

Internal. Defined in includes/payments/functions.php, line 1343.

rpress_get_payment_user_ip()#

Returns the IP address recorded for an order.

rpress_get_payment_user_ip( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns string: IP address.

Defined in includes/payments/functions.php, line 1354.

rpress_get_payment_completed_date()#

Returns the date an order was completed.

rpress_get_payment_completed_date( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string: Completed date, empty if not completed.

Defined in includes/payments/functions.php, line 1365.

rpress_get_payment_gateway()#

Returns the gateway key used for an order.

rpress_get_payment_gateway( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns string: Gateway key, for example cash_on_delivery.

Defined in includes/payments/functions.php, line 1376.

rpress_get_payment_currency_code()#

Returns the currency code of an order.

rpress_get_payment_currency_code( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string: Currency code, for example USD.

Defined in includes/payments/functions.php, line 1387.

rpress_get_payment_currency()#

Returns the currency name of an order.

Looks up the name for the order's currency code. Filterable with rpress_payment_currency.

rpress_get_payment_currency( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string: Currency name.

Defined in includes/payments/functions.php, line 1398.

rpress_get_payment_key()#

Returns the purchase key of an order.

rpress_get_payment_key( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string: Purchase key.

Defined in includes/payments/functions.php, line 1409.

rpress_get_payment_number()#

Returns the order number.

Reads the order's number property, filterable with rpress_payment_number. When sequential order numbers are not enabled, this is the order ID.

rpress_get_payment_number( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string|int: The order number.

Defined in includes/payments/functions.php, line 1422.

rpress_format_payment_number()#

Adds the configured prefix and postfix to an order number.

Uses the sequential_prefix and sequential_postfix options. Returns the number unchanged when sequential numbering is off or the value is not numeric. Filterable with rpress_format_payment_number.

rpress_format_payment_number( $number )

Parameters

ParameterTypeDefaultDescription
$numberint|stringRequiredThe order number.

Returns string|int: The formatted number.

Defined in includes/payments/functions.php, line 1433.

rpress_get_next_payment_number()#

Returns the next order number when sequential numbering is enabled.

Reads the last used number from the rpress_last_payment_number option, or derives it from the latest order. The enable_sequential option holds the starting number. Filterable with rpress_increment_payment_number and rpress_get_next_payment_number.

rpress_get_next_payment_number()

Returns int|string|false: The next number, or false when sequential order numbers are disabled.

Internal. Defined in includes/payments/functions.php, line 1455.

rpress_remove_payment_prefix_postfix()#

Strips the configured prefix and postfix from a formatted order number.

Removes the first occurrence of the sequential_prefix option and the last occurrence of sequential_postfix, then casts the result to an integer. Filterable with rpress_remove_payment_prefix_postfix.

rpress_remove_payment_prefix_postfix( $number )

Parameters

ParameterTypeDefaultDescription
$numberstringRequiredThe formatted order number.

Returns int: The plain number.

Defined in includes/payments/functions.php, line 1497.

rpress_payment_amount()#

Returns an order's total as a formatted string with the currency symbol.

Formats rpress_get_payment_amount() with rpress_format_amount() and rpress_currency_filter() using the order's currency.

rpress_payment_amount( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string: Formatted amount.

Example

echo rpress_payment_amount( 123 );

Defined in includes/payments/functions.php, line 1521.

rpress_get_payment_amount()#

Returns an order's total as a float.

Filterable with rpress_payment_amount.

rpress_get_payment_amount( $payment_id )

Parameters

ParameterTypeDefaultDescription
$payment_idintRequiredThe order (payment) ID.

Returns float: Order total, unformatted.

Defined in includes/payments/functions.php, line 1532.

rpress_payment_subtotal()#

Returns an order's subtotal as a formatted string.

rpress_payment_subtotal( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string: Formatted subtotal with currency symbol.

Defined in includes/payments/functions.php, line 1549.

rpress_get_payment_subtotal()#

Returns an order's subtotal before tax as a float.

rpress_get_payment_subtotal( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns float: Unformatted subtotal.

Defined in includes/payments/functions.php, line 1561.

rpress_payment_tax()#

Returns an order's tax as a formatted string.

rpress_payment_tax( $payment_id = 0, $payment_meta = false )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$payment_metaboolfalseNot used.

Returns string: Formatted tax with currency symbol.

Defined in includes/payments/functions.php, line 1575.

rpress_get_payment_tax()#

Returns an order's tax amount as a float.

rpress_get_payment_tax( $payment_id = 0, $payment_meta = false )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$payment_metaboolfalseNot used.

Returns float: Unformatted tax.

Defined in includes/payments/functions.php, line 1587.

rpress_get_payment_item_tax()#

Returns the tax for one cart line of an order.

Looks up the line by its index in the order's cart details. Returns 0 when the key is false or not present.

rpress_get_payment_item_tax( $payment_id = 0, $cart_key = false )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$cart_keyint|falsefalseIndex of the line in the cart details.

Returns float: Line tax.

Defined in includes/payments/functions.php, line 1599.

rpress_get_payment_fees()#

Returns the fees attached to an order.

Delegates to RPRESS_Payment::get_fees(). Each fee array includes an id key. Filterable with rpress_get_payment_fees.

rpress_get_payment_fees( $payment_id = 0, $type = 'all' )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$typestring'all'Fee type: all, item or fee.

Returns array: List of fee arrays.

Example

foreach ( rpress_get_payment_fees( 123 ) as $fee ) {
	echo $fee['id'] . ': ' . $fee['amount'];
}

Defined in includes/payments/functions.php, line 1616.

rpress_get_payment_transaction_id()#

Returns the gateway transaction ID stored on an order.

rpress_get_payment_transaction_id( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string: Transaction ID, empty if none.

Defined in includes/payments/functions.php, line 1627.

rpress_set_payment_transaction_id()#

Stores a gateway transaction ID on an order.

Saves the _rpress_payment_transaction_id meta after the rpress_set_payment_transaction_id filter. Returns false if either argument is empty.

rpress_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$transaction_idstring''The transaction ID from the gateway.

Returns int|bool: Meta ID or true on success, false otherwise.

Example

rpress_set_payment_transaction_id( 123, 'txn_abc123' );

Note: An order with a transaction ID is no longer recoverable through the payment recovery link.

Defined in includes/payments/functions.php, line 1639.

rpress_get_purchase_id_by_key()#

Returns the order ID for a purchase key.

Queries _rpress_payment_purchase_key. Returns 0 when nothing matches.

rpress_get_purchase_id_by_key( $key )

Parameters

ParameterTypeDefaultDescription
$keystringRequiredThe purchase key.

Returns int|string: The order ID, or 0.

Note: The result is stored in a global variable that is not tied to the key, so a second lookup with a different key in the same request returns the first result. Use rpress_get_payment_by( 'key', $key ) for repeated lookups.

Defined in includes/payments/functions.php, line 1655.

rpress_get_purchase_id_by_transaction_id()#

Returns the order ID for a gateway transaction ID.

Queries _rpress_payment_transaction_id.

rpress_get_purchase_id_by_transaction_id( $key )

Parameters

ParameterTypeDefaultDescription
$keystringRequiredThe transaction ID.

Returns int|string: The order ID, or 0.

Defined in includes/payments/functions.php, line 1678.

rpress_get_payment_notes()#

Returns the notes attached to an order.

Notes are comments of type rpress_payment_note. The functions that hide them from comment lists are removed during the query and restored afterwards. Returns false when both arguments are empty.

rpress_get_payment_notes( $payment_id = 0, $search = '' )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$searchstring''Only return notes containing this text.

Returns array|false: List of WP_Comment objects, oldest first, or false.

Example

foreach ( rpress_get_payment_notes( 123 ) as $note ) {
	echo $note->comment_content;
}

Defined in includes/payments/functions.php, line 1693.

rpress_insert_payment_note()#

Adds a note to an order.

Inserts an approved comment of type rpress_payment_note, attributed to the current user in admin and to no user elsewhere. Fires rpress_pre_insert_payment_note before and rpress_insert_payment_note after.

rpress_insert_payment_note( $payment_id = 0, $note = '' )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.
$notestring''The note text.

Returns int|false: The new note (comment) ID, or false if no order ID was given.

Example

rpress_insert_payment_note( 123, 'Customer called to confirm the address.' );

Defined in includes/payments/functions.php, line 1712.

rpress_delete_payment_note()#

Deletes an order note.

Permanently deletes the comment. Fires rpress_pre_delete_payment_note before and rpress_post_delete_payment_note after.

rpress_delete_payment_note( $comment_id = 0, $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$comment_idint0The note (comment) ID.
$payment_idint0The order the note belongs to.

Returns bool: True on success, false otherwise.

Note: No capability check is made. The order ID is only passed to the hooks.

Defined in includes/payments/functions.php, line 1741.

rpress_get_payment_note_html()#

Returns the admin HTML for a single order note.

Shows the author (or RPRESS Bot), the date, the note content and a delete link with a nonce.

rpress_get_payment_note_html( $note, $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$noteWP_Comment|intRequiredThe note comment object or ID.
$payment_idint0The order the note belongs to.

Returns string: HTML markup.

Internal. Defined in includes/payments/functions.php, line 1757.

rpress_hide_payment_notes()#

Excludes order notes from comment queries.

Hooked to pre_get_comments. Adds rpress_payment_note to type__not_in on WordPress 4.1 and later.

rpress_hide_payment_notes( $query )

Parameters

ParameterTypeDefaultDescription
$queryWP_Comment_QueryRequiredThe comment query object.

Internal. Defined in includes/payments/functions.php, line 1790.

rpress_hide_payment_notes_pre_41()#

Excludes order notes from comment queries on WordPress older than 4.1.

Hooked to comments_clauses. Appends a condition to the where clause only when the WordPress version is below 4.1.

rpress_hide_payment_notes_pre_41( $clauses, $wp_comment_query )

Parameters

ParameterTypeDefaultDescription
$clausesarrayRequiredComment query clauses.
$wp_comment_queryWP_Comment_QueryRequiredThe comment query object.

Returns array: The clauses.

Internal. Defined in includes/payments/functions.php, line 1811.

rpress_hide_payment_notes_from_feeds()#

Excludes order notes from comment feeds.

Hooked to comment_feed_where.

rpress_hide_payment_notes_from_feeds( $where, $wp_comment_query )

Parameters

ParameterTypeDefaultDescription
$wherestringRequiredThe where clause.
$wp_comment_queryWP_Comment_QueryRequiredThe comment query object.

Returns string: The modified where clause.

Internal. Defined in includes/payments/functions.php, line 1827.

rpress_remove_payment_notes_in_comment_counts()#

Excludes order notes from the WordPress comment counts.

Hooked to wp_count_comments. Only acts on index.php and edit-comments.php, and can be disabled by returning true from rpress_count_payment_notes_in_comments. Counts are cached in the counts group.

rpress_remove_payment_notes_in_comment_counts( $stats, $post_id )

Parameters

ParameterTypeDefaultDescription
$statsarray|objectRequiredComment counts from core.
$post_idintRequiredPost ID, or 0 for all posts.

Returns array|object: Comment counts without order notes.

Internal. Defined in includes/payments/functions.php, line 1841.

rpress_filter_where_older_than_week()#

Adds a condition limiting a posts query to items at least seven days old.

Intended for the posts_where filter, as used by rpress_mark_abandoned_orders().

rpress_filter_where_older_than_week( $where = '' )

Parameters

ParameterTypeDefaultDescription
$wherestring''The existing where clause.

Returns string: The where clause with the date condition appended.

Internal. Defined in includes/payments/functions.php, line 1886.

rpress_get_discount_price_by_payment_id()#

Returns the formatted discount amount of an order.

Looks up the discount code in the order's user info. For a flat discount it uses the code's amount; for a percentage discount it sums the discount value of each cart line. Filterable with rpress_discount_price_by_payment.

rpress_get_discount_price_by_payment_id( $payment_id = 0 )

Parameters

ParameterTypeDefaultDescription
$payment_idint0The order (payment) ID.

Returns string|false: Formatted amount, or false if the ID is empty or the order has no valid discount code.

Defined in includes/payments/functions.php, line 1899.

rpress_get_payment_gmt_timestamp()#

Returns the creation time of an order as a GMT Unix timestamp.

Uses post_date_gmt, then the post time, then converts the local post_date. Returns the current time if the order cannot be resolved.

rpress_get_payment_gmt_timestamp( $payment )

Parameters

ParameterTypeDefaultDescription
$paymentint|WP_Post|RPRESS_PaymentRequiredOrder ID or object.

Returns int: GMT Unix timestamp.

Defined in includes/payments/functions.php, line 1933.

rpress_validate_and_cleanup_order_statuses()#

Deletes status meta left behind by orders that no longer exist.

Runs a direct query removing _order_status, _rpress_order_status_updated_at and _pre_trash_status rows whose post does not exist. Trashed orders keep their meta.

rpress_validate_and_cleanup_order_statuses()

Returns int: Number of rows deleted.

Internal. Defined in includes/payments/functions.php, line 1980.

rpress_clean_order_status_on_post_delete()#

Deletes the order status meta of an order post that is being deleted.

Hooked to before_delete_post and delete_post. Acts only on the rpress_payment post type.

rpress_clean_order_status_on_post_delete( $post_id, $post = null )

Parameters

ParameterTypeDefaultDescription
$post_idintRequiredPost ID.
$postWP_Post|nullnullPost object. Loaded when omitted.

Internal. Defined in includes/payments/functions.php, line 2002.

rpress_recount_pending_orders_count()#

Recalculates the pending orders count and clears related caches.

Cleans up orphaned status meta, bumps the rpress_menu_pending_version option, clears the needs-attention cache keys, recounts orders that need attention, stores the count in the rpress_menu_pending_{version} transient for two minutes and flushes the object cache.

rpress_recount_pending_orders_count()

Returns int: The pending orders count.

Note: Called from the admin Refresh Count action.

Internal. Defined in includes/payments/functions.php, line 2021.

rpress_flat_delivery_fee_active()#

Checks whether the built-in flat delivery fee is in use.

True unless the RP_Delivery_Fee class exists, because the Delivery Fee extension replaces this feature. Filterable with rpress_flat_delivery_fee_active.

rpress_flat_delivery_fee_active()

Returns bool: True if the flat fee logic is active.

Defined in includes/rp-delivery-fee-basic.php, line 27.

rpress_get_flat_delivery_fee()#

Returns the configured flat delivery fee.

Reads the flat_delivery_fee option. Filterable with rpress_flat_delivery_fee_amount.

rpress_get_flat_delivery_fee()

Returns float: Fee amount.

Defined in includes/rp-delivery-fee-basic.php, line 37.

rpress_get_checkout_service_fee_display()#

Returns the fee to show on a checkout service option.

Extensions can supply the value through the rpress_checkout_service_fee filter (arguments: null, service type, currently selected service type). If no extension answers, delivery returns the flat delivery fee and any other service returns 0. Reads the service_type cookie.

rpress_get_checkout_service_fee_display( $service_type )

Parameters

ParameterTypeDefaultDescription
$service_typestringRequireddelivery or pickup.

Returns float: Fee amount, never negative when supplied by a filter.

Defined in includes/rp-delivery-fee-basic.php, line 55.

rpress_get_checkout_service_fee_sublabel()#

Returns the fee text shown under a checkout service option.

Returns a string such as "$5.00 fee", "Free" or an empty string. Extensions can supply it with the rpress_checkout_service_fee_sublabel filter. Otherwise the text depends on the calculated fee, the Delivery Fee and Extra Fees extensions, the flat delivery fee and the rpress_has_fee_extension, rpress_fee_extension_non_zero, rpress_pickup_show_free_label and rpress_pickup_fee_managed filters. "Free" is not returned when a fee extension has non-zero fees configured.

rpress_get_checkout_service_fee_sublabel( $service_type )

Parameters

ParameterTypeDefaultDescription
$service_typestringRequireddelivery or pickup.

Returns string: Sublabel text, possibly empty.

Defined in includes/rp-delivery-fee-basic.php, line 89.

rpress_get_checkout_delivery_fee_display()#

Deprecated since 3.4. Use rpress_get_checkout_service_fee_display( 'delivery' )() instead.

Returns the delivery fee shown at checkout.

Compatibility wrapper that calls rpress_get_checkout_service_fee_display( 'delivery' ).

rpress_get_checkout_delivery_fee_display()

Returns float: Fee amount.

Defined in includes/rp-delivery-fee-basic.php, line 204.

rpress_apply_flat_delivery_fee()#

Adds or removes the flat delivery fee on the cart to match the selected service.

Does nothing when rpress_flat_delivery_fee_active() is false. Removes the delivery_fee cart fee, then adds it again when the service_type cookie is delivery, the fee is above 0 and the cart has items. Hooked to several checkout and cart events.

rpress_apply_flat_delivery_fee()

Internal. Defined in includes/rp-delivery-fee-basic.php, line 217.

rpress_flat_delivery_fee_check_service_slot()#

Re-applies the flat delivery fee when a service slot is confirmed.

Filter callback for rpress_check_service_slot. Reads serviceType from the payload because the cookie is not updated yet. Returns the payload unchanged.

rpress_flat_delivery_fee_check_service_slot( $data )

Parameters

ParameterTypeDefaultDescription
$dataarray|WP_ErrorRequiredSanitized request payload.

Returns array|WP_Error: The unchanged payload.

Internal. Defined in includes/rp-delivery-fee-basic.php, line 247.

rpress_flat_delivery_fee_on_service_switch()#

Re-applies the flat delivery fee when the storefront service type is switched.

Hooked to rpress_service_type_switched.

rpress_flat_delivery_fee_on_service_switch( $service_type )

Parameters

ParameterTypeDefaultDescription
$service_typestringRequiredThe newly selected service type.

Internal. Defined in includes/rp-delivery-fee-basic.php, line 270.

rpress_flat_delivery_fee_cart_data()#

Updates AJAX cart data after the flat delivery fee is applied.

Filter callback for rpress_cart_data. Applies the fee and replaces total in the payload with the formatted cart total.

rpress_flat_delivery_fee_cart_data( $data )

Parameters

ParameterTypeDefaultDescription
$dataarrayRequiredCart response payload.

Returns array: The payload with an updated total.

Internal. Defined in includes/rp-delivery-fee-basic.php, line 290.

rpress_order_details_safe_text()#

Converts a value to a plain printable string.

Arrays are flattened recursively and their non-empty scalar values joined with a comma and space. Scalars are trimmed. Anything else returns an empty string.

rpress_order_details_safe_text( $value )

Parameters

ParameterTypeDefaultDescription
$valuemixedRequiredThe value to convert.

Returns string: The text.

Internal. Defined in templates/rpress-show-order-details.php, line 13.

Was this page helpful?