Skip to content

Instantly share code, notes, and snippets.

View NiklasHogefjord's full-sized avatar

Niklas Högefjord NiklasHogefjord

View GitHub Profile
@NiklasHogefjord
NiklasHogefjord / wc-securetrading-filter-billingtelephonetype.php
Last active August 29, 2015 14:24
SecureTrading for WooCommerce - Filter the billingtelephonetype
/**
* WooCommerce - SecureTrading payment gateway
* Filter the billingtelephonetype sent to SecureTrading
*
**/
add_filter('securetrading_billing_phone_type', 'my_securetrading_billing_phone_type');
function my_securetrading_billing_phone_type( ) {
// Available Phone Types are H (Home), W (Work), M (Mobile)
@NiklasHogefjord
NiklasHogefjord / wc-securetrading-filter-version.php
Created July 21, 2015 08:47
SecureTrading for WooCommerce - Filter version sent to SecureTrading
/**
* WooCommerce - SecureTrading payment gateway
* Filter the version sent to SecureTrading
*
**/
add_filter('securetrading_version', 'my_securetrading_version');
function my_securetrading_version( ) {
// Default is 2 since version 1.5 of the plugin
/**
* WooCommerce - Klarna payment gateway
* Filter Create order & Update order for adding separate shipping address fields in Klarna Checkout iframe.
**/
// New order ($create)
add_filter('kco_create_order', 'my_kco_create_order');
function my_kco_create_order( $create ) {
$create['options']['allow_separate_shipping_address'] = true;
@NiklasHogefjord
NiklasHogefjord / WooCommerce - Double.net tracking code example
Last active August 31, 2015 09:54
WooCommerce - Double.net tracking code example
<?php
/**
* WooCommerce - Double.net Tracking code
*
**/
add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
function my_custom_tracking( $order_id ) {
$order = new WC_Order( $order_id );
$reference = ltrim( $order->get_order_number(), '#');
@NiklasHogefjord
NiklasHogefjord / gist:3043748
Created July 3, 2012 22:14
Swedish Greys filter multiple comments text
// Change the output of multiple comments text in Post header meta or Post footer meta
add_filter( 'ntp_multiple_comment_text', 'themename_multiple_comment_text' );
function themename_multiple_comment_text() {
return 'Comments: % Comments';
}
@NiklasHogefjord
NiklasHogefjord / gist:6104436
Created July 29, 2013 13:52
WooCommerce - Remove related products from single product page
<?php
/**
* WooCommerce
* --------------------------
*
* Remove related products
*
* Clear the query arguments for related products so none show.
*
*/
@NiklasHogefjord
NiklasHogefjord / gist:6111426
Created July 30, 2013 09:05
WooCommerce - Hide all prices
<?php
/**
* WooCommerce
* --------------
*
* Hide all prices in your store.
*
* Can be useful when using WooCommerce as a quote tool.
*
*/
@NiklasHogefjord
NiklasHogefjord / gist:7566282
Created November 20, 2013 16:33
WooCommerce, Klarna payment gateway - Add input field for Billing Phone to Klarna (Invoice) Payment gateway Description area.
<?php
/**
* WooCommerce - Klarna
* --------------
*
* Add input field for Billing Phone to Klarna (Invoice) Payment gateway Description area.
*
* Can be useful if the regular WC checkout form is stripped down since Klarna require a Phone number.
*
*/
@NiklasHogefjord
NiklasHogefjord / gist:8175900
Created December 29, 2013 23:18
Swedish Greys - Set the logo area to be as wide as the entire header width
#site-title {
width: 900px;
}
#header-widget {
width: 0px;
}
@NiklasHogefjord
NiklasHogefjord / wc-klarna-modify-kco-checkout-url.php
Last active March 3, 2016 14:46
Change checkout URL for Klarna Checkout if user isn't from a specific country. Can be useful if selling to multiple countries and you want to redirect customers that can't pay with KCO directly to the standard WooCommerce Checkout. Requires Default Customer Address to be set to Geolocate in WooCommerce settings.
<?php
/*
Plugin Name: Modify Klarna Checkout URL
Plugin URI: http://krokedil.com
Description: Change checkout URL for Klarna Checkout if user isn't from a specific country
Version: 1.0
Author: Krokedil
Author URI: http://krokedil.com
*/
add_filter( 'woocommerce_get_checkout_url', 'krokedil_change_checkout_url', 30 );