Skip to content

Instantly share code, notes, and snippets.

@virtuosomaster
virtuosomaster / functions.php
Last active October 29, 2018 17:39
Remove the SKIP button and just direct them to next page if they didn't select any item in group product Woocommerce & Woosteps
//Add directly to the product page
//Header Scripts
<script>
jQuery(function() {
jQuery('a.skip').css("display","none");
jQuery('.summary form').submit(function(e){
var ck_box = jQuery('input[type="checkbox"]:checked').length;
@virtuosomaster
virtuosomaster / woo_function_custom.php
Last active October 9, 2018 02:01
Additional Custom Hook
///////////////////////////////////////////////////////////////////////////////////////////////////
//CUSTOM CODE
//////////////////////////////////////////////////////////////////////////////////////////////////
//Hide Add to Cart notice to all
//add_filter( 'wc_add_to_cart_message_html', '__return_null' );
//Change free to $0 in product Page
add_filter('woocommerce_free_price_html', 'changeFreePriceNotice', 10, 2);
function changeFreePriceNotice($price, $product) {
return '<span class="amount">$0</span>';
@virtuosomaster
virtuosomaster / style.css
Last active September 25, 2018 20:18
SOP Package CSS
/*
CSS for Package
*/
.woocommerce div.product div.summary .price, button.single_add_to_cart_button.button.alt {
float: left !important;
}
.product_cat-package .gform_wrapper .gform_previous_button {
float: right !important;
bottom: -165px;
right: 150px;
@virtuosomaster
virtuosomaster / gist:8e805f82320c116c3835d341cbec1361
Created August 20, 2018 09:58
Hide the price difference displayed for Gravity Forms Product Option fields?
<script type="text/javascript">
function gform_format_option_label( fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId ) {
return fieldLabel + '<span class="ginput_price">$'+price.toFixed(2)+'</span>';
}
</script>
@virtuosomaster
virtuosomaster / gist:f37c8f017239ff659ac173a41487cac2
Created August 15, 2018 11:24
Auto calculate or update Gravity Form total if one of specific fields is change
<script>
//Add .change() in your result code if you wish the value of this field will add to the gravity form total
$('#input_21_29').val('$'+ (parseInt(distance)-35) * 3).change();
</script>
@virtuosomaster
virtuosomaster / woo_functions.php
Last active December 31, 2018 13:55
SOP FF woo_functions.php
<?php
/*
Title: Woo Function
Version: 2.4
Author : Development Funeral Futurist
URL: http://www.funeralfuturist.com/
Date: 2018-08-13
*/
//Add Genesis Layout To
@virtuosomaster
virtuosomaster / functions.php
Last active August 9, 2018 00:55
How to add 10-Key pad to input field instead of alphabetical keyboard with out - Gravity Form & Woocommerce CHeckout Page
<?php
add_filter('body_class','my_body_classes');
function my_body_classes($c) {
wp_is_mobile() ? $c[] = 'mobile' : null;
return $c;
}
@virtuosomaster
virtuosomaster / functions.php
Last active September 25, 2018 08:36
Remove + Sign in Product Dropdown GravityForm
<?php
function remove_plus_function() {
if ( is_singular('product') ) { // only single product pages ?>
<script type="text/javascript">
function gform_format_option_label(fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId) {
// Disable option pricing. Simply return the field label.
// This removes the "+$25.00" or "-$100.00" from the dropdown.
price=(price == 0 ? "" : ' $' + price.toFixed(2) );
finallabel=fieldLabel + '<span class="ginput_price_r">'+ price + '<span>';
return finallabel;
@virtuosomaster
virtuosomaster / functions.php
Created April 12, 2018 08:47
How to modified the home link in Genesis framework Woocommerce Breadcrumbs
<?php
add_filter ( 'genesis_home_crumb', 'sp_breadcrumb_home_link' ); // Genesis >= 1.5
function sp_breadcrumb_home_link( $crumb ) {
if ( is_singular( 'product' ) || is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) {
return preg_replace('/href="[^"]*"/', 'href="/shop/"', $crumb);
}
}
?>
@virtuosomaster
virtuosomaster / functions.php
Created March 13, 2018 07:35
How to add all users with user meta key base on the existing user meta key in wordpress
// Add this to your current functions.php removed once done
$wp_user_query = new WP_User_Query(array('role' => 'Subscriber'));
// Get the results
$users = $wp_user_query->get_results();
// Check for results
if (!empty($users)) {