Does the woocommerce_order_status_changed hook fire when WooCommerce updates an order status automatically? [closed]

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

Unhook action from child theme

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

WooCommerce: Email Notifications

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

How to get all attributes with their terms related to specific Woocommerce product category [closed]

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

WooCommerce checkout: How can I change $field_container of a checkout field?

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

How to change / delete product short description in Woocommerce

Th function wp_set_object_terms() will not work to set post object properties. To add/update/delete product short description there is mainly 2 ways: 1) the WordPress way from a post ID using wp_update_post() function this way: $product_id = $post->ID; // or get_the_id() or $product->get_id() (when $product is available); // The product short description (for testing) $new_short_description = … Read more

How to unhook a function in Woocommerce Template?

You need to unhook the function from that action specifically: remove_action( ‘woocommerce_review_before_comment_meta’, ‘woocommerce_review_display_rating’, 10 ); (e.g. look for the opposite add_action() line in includes/wc-template-hooks.php) You’ll also need to make sure that this is run after WooCommerce has loaded and added the action you’re about to remove, e.g. place this in a plugins_loaded hook: function unhook_display_rating() … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)