This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Don't copy the opening PHP tag | |
*/ | |
add_filter( 'woocommerce_cart_item_subtotal', 'wooninja_display_subtotal', 20, 1 ); | |
add_filter( 'woocommerce_cart_subtotal', 'wooninja_display_subtotal', 20, 1 ); | |
add_filter( 'woocommerce_cart_total', 'wooninja_display_subtotal', 20, 1 ); | |
function wooninja_display_subtotal( $subtotal ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
add_filter( 'woocommerce_subscription_lengths', 'wooninja_custom_subscription_duration' ); | |
/** | |
* Filters the subscription lengths available | |
* @param array $ranges the array of ranges (lengths) | |
* @return array $ranges the filtered array of ranges (lengths) | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Don't copy the opening php tag | |
*/ | |
/* | |
The filter 'wwm_as_admin_script_vars' was added in version 1.6 of Awesome Surveys. | |
This is a sample of it's implementation. If you're comfortable with editing PHP files, use the snippet below. | |
It's usually recommended that these types of snippets be placed in your theme's functions.php file, | |
but I personally don't think that's a good idea since depending on how the theme update works you may |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Change the 'Persons' label to 'Qty. of Chairs' | |
*/ | |
add_filter( 'booking_form_fields', 'wooninja_booking_form_fields' ); | |
function wooninja_booking_form_fields( $fields ) { | |
$fields['wc_bookings_field_persons']['label'] = 'Qty. of Chairs'; | |
return $fields; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add custom column headers to CSV Export. | |
function wc_csv_export_modify_column_headers( $column_headers ) { | |
$new_headers = array( | |
'shipping_country_name' => 'shipping_country_name' | |
// add other column headers here in the format column_key => Column Name | |
); | |
return array_merge( $column_headers, $new_headers ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
//get the price in the input | |
var originalPrice = $('input#nyp').val() | |
var newPrice = originalPrice; | |
//need the product id so a cookie can be set against it, probably won't work if I change themes - but works with storefront | |
var productId = parseInt($('main#main > div').attr('id').replace('product-', '')) | |
//does a cookie exist for this product id? | |
var cookie = getCookie('haggledon-' + productId) | |
if (cookie != null) {//the cookie exists, therefore this person has 'haggled' within 24 hours. Disable the price input. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
//re-assign the error message variable - keep the minimum acceptable price concealed | |
if ( 'undefined' != typeof woocommerce_nyp_params ) { | |
woocommerce_nyp_params.minimum_error = 'Offer rejected'; | |
} | |
//initially disable the price input | |
$('input#nyp').prop('disabled', true) | |
// WooCommerce outputs the product id in a hidden element within the add to cart form. | |
var productId = $('input[name="add-to-cart"]').val() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( function_exists( 'woocommerce_product_search' ) ) { | |
echo woocommerce_product_search(); | |
} else { | |
//the original contents of search.php should follow | |
//make sure to close the php tag as appropriate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//don't include the opening PHP tag | |
add_action( 'template_redirect', 'handsomebeardedguy_redirect_myaccount' ); | |
function handsomebeardedguy_redirect_myaccount() { | |
if ( function_exists( 'is_account_page' ) && is_account_page() && ! is_user_logged_in() ) { | |
wp_redirect( wp_login_url( get_permalink( wc_get_page_id( 'shop' ) ) ) ); | |
exit; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'booking_form_fields', 'handsomebeardedguy_booking_form_fields' ); | |
function handsomebeardedguy_booking_form_fields( $fields ) { | |
if ( isset( $fields['wc_bookings_field_resource'] ) ) { | |
$pattern = '#\(\+<span class="amount">.*\)#'; | |
$replacement = ''; | |
foreach ( $fields['wc_bookings_field_resource']['options'] as $key => $value ) { | |
$fields['wc_bookings_field_resource']['options'][ $key ] = preg_replace( $pattern, $replacement, $value ); | |
} | |
} |