Skip to content

Instantly share code, notes, and snippets.

@Musilda
Created June 26, 2019 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Musilda/83818c1c6cf7de1ea036ec543f73983a to your computer and use it in GitHub Desktop.
Save Musilda/83818c1c6cf7de1ea036ec543f73983a to your computer and use it in GitHub Desktop.
<?php
add_filter( 'gopay_inline_client_id', 'toret_change_client_id', 10, 2 );
function toret_change_client_id( $client_id, $order_id ){
$order = wc_get_order( $order_id );
$shipping = $order->get_items( 'shipping' );
$shipping = array_shift( $shipping );
if( $shipping->get_method_id() == 'flat_rate' ){
return 'my_custom_client_id';
}
return $client_id;
}
add_filter( 'gopay_inline_client_secret', 'toret_change_client_secret', 10, 2 );
function toret_change_client_secret( $client_secret, $order_id ){
$order = wc_get_order( $order_id );
$shipping = $order->get_items( 'shipping' );
$shipping = array_shift( $shipping );
if( $shipping->get_method_id() == 'flat_rate' ){
return 'my_custom_client_secret';
}
return $client_secret;
}
add_filter( 'gopay_inline_goid', 'toret_change_goid', 10, 2 );
function toret_change_goid( $goid, $order_id ){
$order = wc_get_order( $order_id );
$shipping = $order->get_items( 'shipping' );
$shipping = array_shift( $shipping );
if( $shipping->get_method_id() == 'flat_rate' ){
return 'my_custom_goid';
}
return $goid;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment