Skip to content

Instantly share code, notes, and snippets.

WooCommerce.com Documentation woogist

Block or report user

Report or block woogist

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View functions.php
add_filter( 'woocommerce_gforms_strip_meta_html', 'configure_woocommerce_gforms_strip_meta_html' );
function configure_woocommerce_gforms_strip_meta_html( $strip_html ) {
$strip_html = false;
return $strip_html;
}
View functions.php
function wc_subscriptions_custom_price_string( $pricestring ) {
global $product;
$products_to_change = array( 45, 90, 238 );
if ( in_array( $product->id, $products_to_change ) ) {
$pricestring = str_replace( 'every 3 months', 'per season', $pricestring );
}
return $pricestring;
@woogist
woogist / index.html
Created Dec 24, 2014
Create a Dynamic Pricing Discount table in the product page - HTML Example
View index.html
<table>
<thead>
<tr>
<th>From</th>
<th>To</th>
<th>Discount</th>
</tr>
</thead>
<tbody>
<tr>
@woogist
woogist / woocommerce-customer-order-xml-export-suite-custom-plugin.php
Last active Nov 8, 2019
WooCommerce Customer/Order XML Export Suite: Custom Plugin for changing the XML output
View woocommerce-customer-order-xml-export-suite-custom-plugin.php
<?php
/**
* Plugin Name: WooCommerce Sample XML
* Plugin URI: http://www.skyverge.com/contact/
* Description: Customizes the WooCommerce Customer/Order XML Export Suite specifically for Sample
* Author: SkyVerge
* Author URI: http://www.skyverge.com
* Version: 1.0
*
* Copyright: (c) 2013 SkyVerge, Inc. (info@skyverge.com)
@woogist
woogist / functions.php
Last active Sep 30, 2019
Redirect to a custom page after login based on the user role
View functions.php
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
View functions.php
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
function is_product_eligible( $eligible, $product, $discounter_name, $discounter_object ) {
remove_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
if ( $product->is_on_sale() ) {
$eligible = false;
}
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
@woogist
woogist / functions.php
Created Dec 24, 2014
Add a christmas image in the store notice.
View functions.php
/**
* Add a christmas image in the store notice.
*/
function wc_custom_store_notice_christmas( $text ) {
return str_replace( '<p class="demo_store">', '<p class="demo_store"><img src="IMAGE_URL" alt="Merry Christmas" title="Merry Christmas by WooThemes" />', $text );
}
add_filter( 'woocommerce_demo_store', 'wc_custom_store_notice_christmas' );
@woogist
woogist / gist:351c62147604dd8825d3
Created Jun 8, 2015
Sensei: get all the users who have completed a specific course
View gist:351c62147604dd8825d3
/**
* Get the list of users who have completed a specific course:
*/
// Course ID can be found in the URL when you edit the course
$course_id = '2607';
$activity_args = array(
'post_id' => $course_id,
'type' => 'sensei_course_status',
View functions.php
add_action( 'after_setup_theme', 'sensei_support' );
function sensei_support() {
add_theme_support( 'sensei' );
}
@woogist
woogist / functions.php
Created Jun 8, 2015
WooCommerce Product Vendors: Add extra custom fields to vendor profiles
View functions.php
// Add fields to new vendor form
add_action( 'shop_vendor_add_form_fields', 'custom_add_vendor_fields', 2, 1 );
function custom_add_vendor_fields( $taxonomy ) {
?>
<div class="form-field">
<label for="vendor_website"><?php _e( 'Vendor website' ); ?></label>
<input type="text" name="vendor_data[website]" id="vendor_website" class="vendor_fields" /><br/>
<span class="description"><?php _e( 'The vendor\'s website.' ); ?></span>
</div>
<?php
You can’t perform that action at this time.