block countries from shipping to them in WooCommerce [closed]
you can simply go to the woocommerce setting and then find the Selling location(s) in General setting and select sell to all countries except for…
you can simply go to the woocommerce setting and then find the Selling location(s) in General setting and select sell to all countries except for…
Techno Deviser, probably by mistake, in the foreach loop set value to $fragments[‘div.header-cart-count’] instead append it. Try this modification: function iconic_cart_count_fragments( $fragments ) { foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { $fragments[‘div.header-cart-count’] .= ‘<div class=”header-cart-count”>’ .$cart_item_key.'<br><br>’. $cart_item[‘product_id’]. ‘</div>’; } return $fragments; } Or: function iconic_cart_count_fragments( $fragments ) { $cart = WC()->cart->get_cart(); if (!empty($cart)) … Read more
One of the results did bring up this (in reference to woocommerce_order_status_changed): “Where the hook is used (in WC core): Does not used.” Which seems to answer Question 1, which is what leads me to believe if WooCommerce or a payment gateway changes the order status automatically, it will never fire, thus not creating our … Read more
After facing problems with exhausted memory and time consuming queries i’ve tried a different way bulk importing. The idea isn’t new but but to show a possible way i want to share my solution. Keep in mind, i’m not a professional in PHP/MySQL, so maybe there is a more effective or better way to accomplish … Read more
I had exactly the same need, because of the ajax checkout validation. Woocommerce has some custom javascript events we can hook to. In reCaptcha specific case we need to hook to checkout_error that is triggered when the ajax call fails. So, I solved with the following code in my own javascript file, besides the PHP … Read more
I eventually figured this out, I don’t know exactly why, but it seems the issue was due to the original use of init, once i replaced it with ‘wp_head’ it worked correctly, my final code looked like this function change_default_galleria_header() { remove_action( ‘storefront_header’, ‘storefront_header_cart’, 4 ); remove_action( ‘storefront_header’, ‘storefront_product_search’, 3 ); remove_action( ‘storefront_header’, ‘storefront_secondary_navigation’, 6 … Read more
You may be using the wrong hook. I use this : add_action( “woocommerce_email_after_order_table”, “custom_woocommerce_email_after_order_table”, 10, 1); function custom_woocommerce_email_after_order_table( $order ) { echo ‘<p>content after email table</p>’; } now, if you look at this link it will show you other hooks that you can use if you want to append other information to the email. for … Read more
No, this is not safe. You shouldn’t make any changes to files within a plugin’s directory, all of those changes may be overridden. If you want to change a translation, you can use a plugin such as Loco Translate or use the gettext filter.
Well, I found the following solution: $args = array( ‘category’ => array( ‘category_slug’ ) // or ‘term_taxonomy_id’ => 4 i.e. category ID ); foreach( wc_get_products($args) as $product ){ foreach( $product->get_attributes() as $attr_name => $attr ){ echo wc_attribute_label( $attr_name ); // attr label // or get_taxonomy( $attr_name )->labels->singular_name; foreach( $attr->get_terms() as $term ){ echo $term->name; } … Read more
The woocommerce_form_field() is a pluggable function, defined as follows: if ( ! function_exists( ‘woocommerce_form_field’ ) ) { /** * Outputs a checkout/address form field. * * @param string $key Key. * @param mixed $args Arguments. * @param string $value (default: null). * @return string */ function woocommerce_form_field( $key, $args, $value = null ) { … … Read more