"custom inpute number blommer" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "custom inpute number blommer" answered properly. Developers are finding an appropriate answer about custom inpute number blommer related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like custom inpute number blommer. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on custom inpute number blommer.
custom inpute number blommer
/**
* @snippet Plus Minus Quantity Buttons @ WooCommerce Single Product Page
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @compatible WooCommerce 3.8
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
// -------------
// 1. Show Buttons
add_action( 'woocommerce_before_add_to_cart_quantity', 'bbloomer_display_quantity_plus' );
function bbloomer_display_quantity_plus() {
echo '<button type="button" class="plus" >+</button>';
}
add_action( 'woocommerce_after_add_to_cart_quantity', 'bbloomer_display_quantity_minus' );
function bbloomer_display_quantity_minus() {
echo '<button type="button" class="minus" >-</button>';
}
// Note: to place minus @ left and plus @ right replace above add_actions with:
// add_action( 'woocommerce_before_add_to_cart_quantity', 'bbloomer_display_quantity_minus' );
// add_action( 'woocommerce_after_add_to_cart_quantity', 'bbloomer_display_quantity_plus' );
// -------------
// 2. Trigger jQuery script
add_action( 'wp_footer', 'bbloomer_add_cart_quantity_plus_minus' );
function bbloomer_add_cart_quantity_plus_minus() {
// Only run this on the single product page
if ( ! is_product() ) return;
?>
<script type="text/javascript">
jQuery(document).ready(function($){
$('form.cart').on( 'click', 'button.plus, button.minus', function() {
// Get current quantity values
var qty = $( this ).closest( 'form.cart' ).find( '.qty' );
var val = parseFloat(qty.val());
var max = parseFloat(qty.attr( 'max' ));
var min = parseFloat(qty.attr( 'min' ));
var step = parseFloat(qty.attr( 'step' ));
// Change the value if plus or minus
if ( $( this ).is( '.plus' ) ) {
if ( max && ( max <= val ) ) {
qty.val( max );
} else {
qty.val( val + step );
}
} else {
if ( min && ( min >= val ) ) {
qty.val( min );
} else if ( val > 1 ) {
qty.val( val - step );
}
}
});
});
</script>
<?php
}
Source: www.businessbloomer.com
All those coders who are working on the Whatever based application and are stuck on custom inpute number blommer can get a collection of related answers to their query. Programmers need to enter their query on custom inpute number blommer related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about custom inpute number blommer for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of custom inpute number blommer while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "custom inpute number blommer". Visit this developer's friendly online web community, CodeProZone, and get your queries like custom inpute number blommer resolved professionally and stay updated to the latest Whatever updates.