Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Add a fee when the user checks out with PayPal
*/
function wcfad_apply_payment_gateway_fee() {
$payment_method = WC()->session->get( 'chosen_payment_method' );
// Only apply the fee if the payment gateway is PayPal
// Note that you might need to check this slug, depending on the PayPal gateway you're using
if( $payment_method == 'ppec_paypal' ) {
$label = __( 'PayPal fee', 'wcfad' );
@edwanyoike
edwanyoike / functions.php
Created February 22, 2021 18:59 — forked from fedek6/functions.php
Ajax support for WP Newsletter plugin (https://www.thenewsletterplugin.com)
<?php
/** @constant string THEME_NAME **/
define( 'THEME_NAME', get_option('stylesheet') );
/**
* Custom script
*/
function my_scripts_method() {
wp_enqueue_script(
'custom-script',
@edwanyoike
edwanyoike / HttpHeader.java
Created February 11, 2019 11:40 — forked from nioe/HttpHeader.java
Get remote IP from HttpServletRequest
public enum HttpHeader {
AUTHORIZATION("Authorization"),
AUTHENTICATION_TYPE_BASIC("Basic"),
X_AUTH_TOKEN("X-AUTH-TOKEN"),
WWW_Authenticate("WWW-Authenticate"),
X_FORWARDED_FOR("X-Forwarded-For"),
PROXY_CLIENT_IP("Proxy-Client-IP"),
WL_PROXY_CLIENT_IP("WL-Proxy-Client-IP"),
HTTP_CLIENT_IP("HTTP_CLIENT_IP"),
HTTP_X_FORWARDED_FOR("HTTP_X_FORWARDED_FOR");