Created
June 26, 2019 21:16
-
-
Save Musilda/83818c1c6cf7de1ea036ec543f73983a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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