Very specific issue but, I've been dragged onto an issue with our companies Payment Gateway on our Wordpress / Woocommerce website where we are using the Opayo Plugin (For Opayo Direct).
The issue is:
- When originally setup, there was no template / option selected for the
Referencefield on the data / object sent to the API
The guys originally doing the website then tried contacting the original developer of this now unsupported plugin to which they was sent some code to put into another plugin named PHP Injection the code was similar to below:
add_filter( 'opayo_direct_custom_field_vendordata', 'my_opayo_direct_custom_field_vendordata', 10, 2 );
function my_opayo_direct_custom_field_vendordata ( $vendordata, $order ) {
// Get Order ID
$order_id = $order->get_order_number();
$reference = "test_" . $order_id;
// Get the reference field - set '_reference_field' to the meta_key from your order
if( isset( get_post_meta( $order_id, '_reference_field', TRUE ) ) ) {
$vendordata = get_post_meta( $order_id , '_reference_field', TRUE );
//$vendordata['_reference_field'] = $reference; ### Commented as I'm unsure if this is correct
}
return $vendordata;
}
After doing numerous testing and small changes, still nothing seems to be showing up in the Reference field in Opayo itself?
Please tell me someone has encountered this situation before or knows what I might be missing, it's been a while since I've touched PHP