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’ ); } }
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);});}
Refresh cart_fragments(mini-cart) by PHP or jQuery
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);});}
Fragments to Update Cart Counter not working
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);});}