This file contains 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_action( 'woocommerce_after_add_to_cart_form', 'radio_waitlist_label' ); | |
function radio_waitlist_label() { | |
echo " | |
<script> | |
jQuery(document).ready(function($) { | |
var variation_data = $('form.variations_form').attr('data-product_variations'); | |
var variation_data = JSON.parse(variation_data); | |
$('.variations td.value div input').each(function() { | |
for (var i = 0; i < variation_data.length; i++) { | |
var variation = variation_data[i]; |
This file contains 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_action( 'woocommerce_after_single_product', 'activate_review_tab' ); | |
function activate_review_tab() { | |
echo '<script> | |
jQuery(document).ready(function ($) { | |
$("#add_review").click(function(){ | |
var currentTab = $(this).attr("href"); | |
$(".woocommerce-tabs .panel").hide(); |
This file contains 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 | |
// function 'get_post_id_by_meta_key_and_value' found at https://gist.github.com/feedmeastraycat/3065969 | |
function get_post_id_by_meta_key_and_value( $key, $value ) { | |
global $wpdb; | |
$meta = $wpdb->get_results("SELECT * FROM `".$wpdb->postmeta."` WHERE meta_key='".$wpdb->escape($key)."' AND meta_value='".$wpdb->escape($value)."'"); | |
if (is_array( $meta ) && !empty( $meta ) && isset( $meta[0]) ) { | |
$meta = $meta[0]; | |
} | |
if ( is_object( $meta ) ) { | |
return $meta->post_id; |
This file contains 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_action( 'woocommerce_after_add_to_cart_form', 'dropdown_waitlist_label' ); | |
function dropdown_waitlist_label() { | |
echo " | |
<script> | |
jQuery(document).ready(function($) { | |
var variation_data = $('form.variations_form').attr('data-product_variations'); | |
var variation_data = JSON.parse(variation_data); |
This file contains 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 | |
// Gets the name of the brand | |
function output_brand() { | |
$terms = get_the_terms( $post->ID , 'brand' ); | |
if ( empty($terms) == false ) { | |
foreach ( $terms as $term ) { | |
return $term->name; | |
} |