Skip to content

Instantly share code, notes, and snippets.

View tamarazuk's full-sized avatar
👩‍💻

Tamara Zuk tamarazuk

👩‍💻
View GitHub Profile
@tamarazuk
tamarazuk / social-login.php
Created January 22, 2016 06:28
WooCommerce Social Login: Customize user date
<?php // only copy this line if needed
function sv_wc_social_login_new_user_data_add_filters() {
foreach ( array_keys( wc_social_login()->get_available_providers() ) as $provider ) {
add_filter( 'wc_social_login_' . $provider . '_new_user_data', 'sv_wc_social_login_new_user_data' );
}
}
add_action( 'init', 'sv_wc_social_login_new_user_data_add_filters' );
@tamarazuk
tamarazuk / wc-csv-import-disable-customer-change-emails.php
Last active March 31, 2020 03:55
WooCommerce CSV Import - Disable WP user email/password change emails
<?php // only copy this line if needed
add_filter( 'send_password_change_email', '__return_false' );
add_filter( 'send_email_change_email', '__return_false' );
@tamarazuk
tamarazuk / wc-csv-export-auto-export-subs-renewals.php
Created January 6, 2016 00:56
WooCommerce Customer/Order CSV Export - Auto-export only orders with subscriptions or renewals
<?php // only copy this line if needed
function sv_wc_customer_order_csv_auto_export_subscriptions_renewals_only( $order_ids ) {
if ( defined( 'DOING_CRON' ) && DOING_CRON && function_exists( 'wcs_order_contains_subscription' ) ) {
$subscriptions = $renewals = array();
$subscriptions = array_filter( $order_ids, 'wcs_order_contains_subscription' );
$renewals = array_filter( $order_ids, 'wcs_order_contains_renewal' );
@tamarazuk
tamarazuk / pdf-product-vouchers.php
Created October 20, 2015 06:33
WooCommerce Multilingual - Compatability with PDF Product Vouchers
<?php //only copy this line if needed
// WPML WooCommerce Multilingual compatability with PDF Product Vouchers
function sv_wc_pdf_product_vouchers_wc_multilingual_duplicate_exception( $exclude, $cart_item ) {
if ( isset( $cart_item[ 'voucher_id' ] ) ) {
$exclude = true;
}
return $exclude;
@tamarazuk
tamarazuk / mpc.php
Last active October 20, 2015 01:45
WPML WooCommerce Multilingual compatability with Measurement Price Calculator
<?php // only copy this line if needed
// WPML WooCommerce Multilingual compatability with Measurement Price Calculator
function sv_wc_mpc_woocommerce_multilingual_duplicate_exception( $exclude, $cart_item ) {
if ( isset( $cart_item[ 'pricing_item_meta_data' ] ) ) {
$exclude = true;
}
return $exclude;
@tamarazuk
tamarazuk / social-login.php
Created September 15, 2015 21:16
WooCommerce Social Login - Request user location from Facebook
function sv_wc_social_login_facebook_user_location( $config ) {
$config['scope'] = $config['scope'] . ', user_location';
return $config;
}
add_filter( 'wc_social_login_facebook_opauth_config', 'sv_wc_social_login_facebook_user_location' );
@tamarazuk
tamarazuk / sv-wc-measurement-price-calculator-translate-labels-example.php
Last active April 30, 2021 14:20
WooCommerce Measurement Price Calculator - Translate labels
<?php // only copy this line if needed
function sv_mpc_measurement_label( $label ) {
if ( 'fr_FR' === get_locale() ) {
$label = str_replace( 'Required Width', 'Largeur requise', $label );
$label = str_replace( 'Width', 'Largeur', $label );
}
return $label;
@tamarazuk
tamarazuk / skyverge-snippets.php
Created June 18, 2015 03:33
WooCommerce Shipwire - Remove notices
function sv_wc_shipwire_remove_notice( $message ) {
$shipwire_notices = array(
'Please enter your country to see available shipping rates.',
'Please enter your ZIP Code to see available shipping rates.',
);
if ( in_array( $message, $shipwire_notices ) ) {
$message = '';
}
@tamarazuk
tamarazuk / wc-tab-manager-conditionally-hide-tab.php
Created June 16, 2015 23:15
WooCommerce Tab Manager - Conditionally hide tab
<?php
function wc_tab_manager_product_tabs_hide_books_tab( $tabs ) {
global $product;
// + check if we are on the product page before removing the tab so that the
// tab still displays in the admin
// + change some_condition() to a function/variable which returns true if the
// product should be displayed
// + "unique-tab-name" is uniquely generated by Tab Manager and can be found by
// inspecting the source on a product page and finding the HTML which outputs
@tamarazuk
tamarazuk / mpc.php
Created June 8, 2015 17:56
Measurement Price Calculator: Set step increment for user-defined measurements
function sv_wc_measurement_price_calculator_amount_needed() {
wc_enqueue_js( '
$( "input.amount_needed" ).attr( { "step" : "0.1", "type" : "number" } );
' );
}
add_action( 'wp_enqueue_scripts', 'sv_wc_measurement_price_calculator_amount_needed' );