Skip to content

Instantly share code, notes, and snippets.

<?php // Use only if required.
if ( ! function_exists( 'my_custom_event_function' ) ) {
function my_custom_event_function() {
wc_google_analytics_pro()->get_integration()->custom_event( 'onBannerClick', array(
'hitType' => 'event',
'eventCategory' => 'Outbound Link',
'eventAction' => 'click',
'eventLabel' => 'Shopping-Banner',
'eventValue' => null,
@harishankerr
harishankerr / gist:bffd6c211bb6afb23fed9621622d9579
Created August 26, 2016 10:38
Move Location of WooCommerce Variable Products
woocommerce_after_add_to_cart_button
@harishankerr
harishankerr / variable-product-description.php
Last active August 26, 2016 10:40
Move Location of WooCommerce Variable Products
<?php
/* Add this to your theme's functions.php to move the variation description display to a different location
* on the product page.
*/
add_action('plugins_loaded', 'move_variation_description', 50);
function move_variation_description(){
// Remove the hook from the original location
<?php
function social_login_button() {
echo do_shortcode('[woocommerce_social_login_buttons return_url="http://yoursite.com/your-checkout-url"]');
}
add_action( 'woocommerce_before_checkout_billing_form', 'social_login_button' );
?>
@harishankerr
harishankerr / tnt-express-tracking.php
Last active August 12, 2016 11:13
TNT Express Tracking Workaround for WooCommerce Shipment Tracking Plugin
<?php // Use only if required
// Custom snippet to add TNT Shipping Functionality for the WooCommerce Shipment Traciking Plugin.
add_filter( 'wc_shipment_tracking_get_providers', '_wc_shipment_tracking_tnt_express_domestic' );
function _wc_shipment_tracking_tnt_express_domestic( $providers ) {
$providers['United Kingdom']['TNT Express domestic (consignment)'] = 'https://www.tnt.com/webtracker/tracking.do?cons=%1$s&trackType=CON&respLang=en&respCountry=gb&sourceCountry=gb&requestType=GEN&searchType=CON';
return $providers;
}
@harishankerr
harishankerr / wc-price-free-cart.php
Last active August 12, 2016 11:27
Modify the display of free price in cart
<?php // only copy if needed
/**
* Change cart price display for free products
*
* @param string $price_html the price display html
* @param \WC_Product
* @return string - updated pricing html
*/
function sv_wc_free_cart_price( $price_html, $product ) {