<?php
add_filter('woocommerce_dropdown_variation_attribute_options_args','woo_select_default_option',10,1);
function woo_select_default_option( $args)
{
if(count($args['options']) > 0) //Ensure product variation isn't empty
$args['selected'] = $args['options'][0];
return $args;
}
add_action( 'woocommerce_variable_add_to_cart', 'bbloomer_update_price_with_variation_price' );
function bbloomer_update_price_with_variation_price() {
if(is_product()){
global $product;
$price = $product->get_price_html();
wc_enqueue_js( "
$(document).on('found_variation', 'form.cart', function( event, variation ) {
if(variation.price_html) $('.sp01 p.price').html(variation.price_html);
$('.woocommerce-variation-price').hide();
});
$(document).on('hide_variation', 'form.cart', function( event, variation ) {
$('.sp01 p.price').html('" . $price . "');
});
" );
}
}
add_filter('woocommerce_available_variation', function($available_variations, \WC_Product_Variable $variable, \WC_Product_Variation $variation) {
if (empty($available_variations['price_html'])) {
$available_variations['price_html'] = '<span class="price">' . $variation->get_price_html() . '</span>';
}
return $available_variations;
}, 10, 3);
?>
<?php
# SOURCE: https://codedcommerce.com/woo/change-variation-drop-downs-to-radio-buttons/
add_action( 'woocommerce_variable_add_to_cart', function() {
add_action( 'wp_print_footer_scripts', function() {
?>
<script type="text/javascript">
// DOM Loaded
document.addEventListener( 'DOMContentLoaded', function() {
// Get Variation Pricing Data
var variations_form = document.querySelector( 'form.variations_form' );
var data = variations_form.getAttribute( 'data-product_variations' );
data = JSON.parse( data );
// Loop Drop Downs
document.querySelectorAll( 'table.variations select' )
.forEach( function( select ) {
// Loop Drop Down Options
select.querySelectorAll( 'option' )
.forEach( function( option ) {
// Skip Empty
if( ! option.value ) {
return;
}
// Get Pricing For This Option
var pricing = '';
data.forEach( function( row ) {
if( row.attributes[select.name] == option.value ) {
pricing = row.price_html;
}
} );
// Create Radio
var radio = document.createElement( 'input' );
radio.type = 'radio';
radio.name = select.name;
radio.value = option.value;
radio.checked = option.selected;
var label = document.createElement( 'label' );
label.appendChild( document.createTextNode( ' ' + option.text + ' ' ) );
var div = document.createElement( 'div' );
div.classList.add('button_variation');
div.appendChild( radio );
div.appendChild( label );
// Insert Radio
select.closest( 'td' ).appendChild( div );
// Handle Clicking
radio.addEventListener( 'click', function( event ) {
select.value = radio.value;
jQuery( select ).trigger( 'change' );
} );
} ); // End Drop Down Options Loop
// Hide Drop Down
select.style.display = 'none';
} ); // End Drop Downs Loop
} ); // End Document Loaded
</script>
<?php
} );
} );
?>
15pcs Conical Drills with Stoppers
1.8mm / 2.2mm – S1
1.8mm / 2.2mm – S3
1.8mm / 2.2mm – S5
2.2mm / 2.7mm – S1
2.2mm / 2.7mm – S3
2.2mm / 2.7mm – S5
2.2mm / 3.3mm – S1
2.2mm / 3.3mm – S3
2.2mm / 3.3mm – S5
2.7mm / 3.7mm – S1
2.7mm / 3.7mm – S3
2.7mm / 3.7mm – S5
2.8mm / 4.5mm – S1
2.8mm / 4.5mm – S3
2.8mm / 4.5mm – S5
Bone Expander Screws
2.6mm, 3.0mm, 3.4mm, 3.8mm, 4.3mm
Titanium coated Drills
2.0mm, 2.5mm, 2.8mm, 3.2mm, 3.65mm, 4.2mm, 4.5mm, 5.2mm
Trephine Drills 8pcs
3.0mm, 4.0mm, 5.0mm, 6.0mm, 7.0mm, 8.0mm, 9.0mm, 10.0mm
Compression Screw 2.8mm/4.2mm
Compression Screw 4.0mm
Pilot Drill 1.8mm
Drill Extender
Ratchet Driver 1.25mm
Hand Driver 2.42mm
Torque Wrench 10-50Ncm
Depth Gauge
Saw Disc 7.0mm
Saw Disc 10.0mm
Tissue Punch 5.0mm
Drill 2.8mm
Drill 4.5mm
Reviews
There are no reviews yet.