Skip to content

Instantly share code, notes, and snippets.

View woogists's full-sized avatar

WooGists woogists

View GitHub Profile
@woogists
woogists / wc-google-analytics-pro-tracking-events.php
Created March 9, 2018 14:59
[Google Analytics Pro] Tracking custom events
wc_google_analytics_pro()->get_integration()->custom_event( $event_name, $properties );
@woogists
woogists / wc-drip-subscribe-params.php
Created March 9, 2018 15:08
[WooCommerce Drip] This filter allows you to modify parameters used to subscribe a customer to a campaign during registration.
add_filter( 'wcdrip_checkout_subscribe_params', 'drip_make_optin_single' );
add_filter( 'wcdrip_register_subscribe_params', 'drip_make_optin_single' );
function drip_make_optin_single( $params ) {
$params['double_optin'] = false;
return $params;
}
@woogists
woogists / wc-photography-change-visibility.php
Created March 9, 2018 15:10
[WooCommerce Photography] This snippet will prevent customers from changing permissions for a collection.
add_filter( 'woocommerce_photography_customers_can_change_visibility', '__return_true' );
@woogists
woogists / wc-pdf-watermarks-change-password-pdf-downloads.php
Created March 9, 2018 15:11
[WooCommerce PDF Watermarks] Change password used for protecting PDF downloads
/*
* Snippet to change password used for protecting PDF download
* Code goes in the functions.php file in your theme.
*/
function wc_pdf_watermark_change_pdf_password( $order_id, $product_id ) {
// Use the order number for the password instead of the billing email
$order = wc_get_order( $order_id );
return $order->get_order_number();
}
@woogists
woogists / wc-ninja-forms-product-add-ons-hide-zero-price-add-ons.php
Created March 9, 2018 15:14
[WooCommerce Ninja Forms Product Add-ons] Hide price add-ons equal to zero
/*
* Snippet to hide price add-ons equal to zero.
* Code goes in the functions.php file in your theme.
*/
add_filter( 'wc_nf_addons_format_cart_item_price' , 'wc_ninja_forms_hide_zero_price' );
function wc_ninja_forms_hide_zero_price( $value ) {
$hide_price = ' (' . wc_price( '0.00' ) . ')';
@woogists
woogists / wc-anti-fraud-remove-risk-countries.php
Created March 9, 2018 15:17
[WooCommerce Anti Fraud] You can add or remove risk countries by using the ‘wc_af_rule_countries’ filter.
function wc_af_example_rule_countries( $countries ) {
$countries[] = 'NL'; // Adding The Netherlands as a risk country
return $countries;
}
add_filter( 'wc_af_rule_countries', 'wc_af_example_rule_countries' );
@woogists
woogists / wc-ninja-forms-product-add-ons-hide-sub-prices.php
Created March 9, 2018 15:22
[WooCommerce Ninja Forms Product Add-ons] Hide All Sub Prices
/*
* Snippet to hide all sub prices
* Code goes in the functions.php file in your theme.
*/
add_filter( 'wc_nf_addons_cart_option', 'wc_ninja_forms_price' );
function wc_ninja_forms_price( $display ) {
return '';
}
@woogists
woogists / wc-change-the-speed.php
Last active March 9, 2018 15:23
[WooCommerce 360 Image] Change the speed of the animation
add_filter( 'wc360_js_speed', 'wcs_360_custom_speed' );
function wcs_360_custom_speed() {
return 30;
}
@woogists
woogists / wc-360-rotate90.php
Created March 9, 2018 15:56
[WooCommerce 360 Image] Custom Rotation
/* Rotate 360 Image 90 Degrees */
.threesixty .threesixty_images img {
-ms-transform: rotate(90deg); /* IE 9 */
-webkit-transform: rotate(90deg); /* Chrome, Safari, Opera */
transform: rotate(90deg);
}
@woogists
woogists / wc-rotate-minus90degrees.php
Created March 9, 2018 15:58
[WooCommerce 360 Image] Rotate -90 degrees
/* Rotate 360 Image -90 Degrees */
.threesixty .threesixty_images img {
-ms-transform: rotate(-90deg); /* IE 9 */
-webkit-transform: rotate(-90deg); /* Chrome, Safari, Opera */
transform: rotate(-90deg);
}