How to add custom text field with product for checkout in Woocommerce?
Custom Text field for custom product in woocommerce if ( ! function_exists( ‘yith_wc_custom_input_text’ ) ) { /** * Display input text before add to cart button. */ function yith_wc_custom_input_text() { global $product; $product_id = $product ? $product->get_id() : 0; $products_to_show = array( 2874, 28 ); if ( $product_id && in_array( $product_id, $products_to_show ) ) { […]
How to Add Country Code in Woocommerce Billing Phone Field
// Add country calling code prefix in woocommerce billing phone add_action( ‘wp_footer’, ‘wpsh_add_callback’ ); function wpsh_add_callback(){ ?>
Remove checkout fields for a defined product category in Woocommerce
add_filter( ‘woocommerce_checkout_fields’, ‘conditionally_remove_checkout_fields’, 25, 1 ); function conditionally_remove_checkout_fields( $fields ) { // HERE the defined product Categories $categories = array(‘house’); $found = false; // CHECK CART ITEMS: search for items from our defined product category foreach ( WC()->cart->get_cart() as $cart_item ){ if( has_term( $categories, ‘product_cat’, $cart_item[‘product_id’] ) ) { $found = true; break; } } […]
Check if Product ID is Contained in the Cart – WooCommerce
add_action( ‘woocommerce_before_cart’, ‘bbloomer_find_product_in_cart’ ); function bbloomer_find_product_in_cart() { $product_id = 282; $product_cart_id = WC()->cart->generate_cart_id( $product_id ); $in_cart = WC()->cart->find_product_in_cart( $product_cart_id ); if ( $in_cart ) { $notice = ‘Product ID ‘ . $product_id . ‘ is in the Cart!’; wc_print_notice( $notice, ‘notice’ ); } }
Print PDF directly from JavaScript
Print PDF directly from JavaScript function printFile(url) { const iframe = document.createElement(‘iframe’); iframe.src = url; iframe.style.display = ‘none’; document.body.appendChild(iframe); // Use onload to make pdf preview work on firefox iframe.onload = () => { iframe.contentWindow.focus(); iframe.contentWindow.print(); }; }
How to validate email in js?

How to validate email in js? Email validation is a crucial aspect of web development when it comes to ensuring data integrity and user experience. Whether you’re building a registration form, a subscription service, or any application that requires user input, validating email addresses is essential to prevent errors and improve overall usability. In this […]
The Ultimate Guide: Unleash the Power of eCommerce Websites and Transform Your Business with Woocoders!
Introduction In today’s digital age, eCommerce websites have become indispensable for businesses of all sizes. The power and potential of an effective eCommerce platform can catapult your business to new heights, allowing you to reach a global audience, increase sales, and enhance customer experiences. In this ultimate guide, brought to you by Woocoders, we will […]
Wc_fragment_refresh not working (solved)
How to update minicart after product added into cart?
They move the global enqueue support for fragments refreshso call wp_enqueue_script( ‘wc-cart-fragments’ ); in your theme or Call the WC_AJAX::get_refreshed_fragments() at the end of your PHP coode responder; if it comes from an AJAX call var fragments = response.fragments; if ( fragments ) {jQuery.each(fragments, function(key, value) {jQuery(key).replaceWith(value);});}
WooCommerce shopping mini cart isn’t updated after ajax adding items
They move the global enqueue support for fragments refreshso call wp_enqueue_script( ‘wc-cart-fragments’ ); in your theme or Call the WC_AJAX::get_refreshed_fragments() at the end of your PHP coode responder; if it comes from an AJAX call var fragments = response.fragments; if ( fragments ) {jQuery.each(fragments, function(key, value) {jQuery(key).replaceWith(value);});}