mycred_woo_order_cost

Codex / mycred/payment / Filters / mycred_woo_order_cost

Description

This filter allows you to adjust the point cost calculation in WooCommerce. The filter is used in two different instances in WooCommerce:

a) In Cart

When a user views their cart on both the cart page and on the checkout page, the filter is used to calculate the users cart total in points.

b) When paying using points

When a user selects to pay using points on the checkout page, the filter is used to calculate the amount of points a user must pay for the order. If the user does not have the point amount this filter returns, the payment is declined.

By default, the exchange rate you set in your settings is used to calculate the cost but you can use this filter to run your own calculation.

Available since version 1.0

Parameters

Param Type Required Description
$cost - Yes

The cost of the cart / order in your store currency.

$order_or_cart obj No

Either the cart object or the order object, depending on where the filter is used.

$is_cart bool No

Returns TRUE if the filter is used when showing the cart total cost in points and FALSE when calculating the cost during checkout (if the buyer selected to pay using points).

$gateway obj No

The myCRED payment gateway object.

Used By

Package Prio. Description
mycred/payment 10 Used by the myCRED payment gateway.

Example

Example 1: Apply a custom exchange rate for users with the ``Author`` role. Everyone else gets the exchange rate you set in your settings.

Last edited August 11, 2016