The ag_opayo_modify_basket
filter allows developers to modify the $basket
string in the get_cart_items()
function before it’s returned. This filter is helpful for customising the basket structure by adding, modifying, or removing items and data within the $basket
string.
The ag_opayo_modify_basket
filter enables developers to hook into the get_cart_items()
function, allowing them to modify the basket details of an order dynamically. This could include adjusting item details, fees, or adding custom entries like discounts or promotional items without directly altering the core codebase.
ag_opayo_modify_basket
: The unique identifier for this filter, which developers will use to hook into and modify the $basket
data.WC_Order
object from WooCommerce, providing access to detailed order data for the current transaction.A developer can then hook into this filter using add_filter()
to modify the $basket
content:
In this callback:
modify_basket_payload
receives both $basket
and $order
.$newBasket
and returns the modified string, which will then be used in the get_cart_items()
output.Was this helpful?
Our team are on hand to provide fast, helpful and professional support.
Start exploring our fully functional demo site today.
Gain exclusive admin access to see what's possible.