How to run JavaScript function in WooCommerce checkout?

I’m building reCAPATCHA into my WooCommerce checkout. It is a fairly easy process as I’m using woocommerce_checkout_process to validate the capatcha. However, I have running into one issue. When there is a cart error, I want to be able to reset the reCAPATCHA using grecaptcha.reset(); JavaScript function. I’m unsure how to run the JavaScript command … Read more

Unhook action from child theme

I have decided to use a WooCommerce Storefront child theme called Galleria, when I have previously used the Storefront theme I have used the common remove_action to unhook the defaults and replaced with my own add_action. However as Galleria is a child theme of Storefront, it has its own add_action in the file class-galleria-structure.php though … Read more

WooCommerce: Email Notifications

How can I append text to the WooCommerce email messages without overriding the existing templates. Ideally I want to add different messages to each email, without overriding the default templates. I’ve tried to hook into the following actions: do_action( ‘woocommerce_email_order_details’, $order, $sent_to_admin, $plain_text, $email ); And: do_action( ‘woocommerce_email_header’, $email_heading, $email ); In both cases it … Read more

Is is safe to edit language files from wp-content/languages/plugins/woocommerce-ro_RO?

Is is safe to edit language files from wp-content/languages/plugins/ ? I’m asking this because I don’t want them to be overriden on plugin update. Sorry if dumb question. 2 Answers 2 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 … Read more

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

Closed. This question is off-topic. It is not currently accepting answers. Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third party plugins and themes are off topic, they are better asked about at their developers’ support routes. Closed 3 … Read more

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

By default the checkout fields are wrapped inside <p class=”form-row… HTML by the woocommerce_form_field() core function (see $field_container) – I want to change that bahaviour. How could this be done without altering the core function? 1 Answer 1 The woocommerce_form_field() is a pluggable function, defined as follows: if ( ! function_exists( ‘woocommerce_form_field’ ) ) { … Read more

How to change / delete product short description in Woocommerce

How to change / delete product short description in Woocommerce I use $short_desc = $post->post_excerpt; to read the property but I cant change it with wp_set_object_terms($post->ID, $post->post_excerpt, ‘new excerpt’); 2 Answers 2 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 … Read more

How to unhook a function in Woocommerce Template?

I have a basic question that has always stumped me. I’m trying to move the Star Rating into the comment meta, which will help me style it. Here’s the template file review.php section: <div class=”comment-text”> <?php /** * The woocommerce_review_before_comment_meta hook. * * @hooked woocommerce_review_display_rating – 10 //Want to unhook this. */ do_action(‘woocommerce_review_before_comment_meta’, $comment); /** … Read more

Auto update cart after quantity change

I am trying to Auto update the woocommerce cart after quantity is changed. The following code within the function.php is working, BUT updates the cart only if I change the quantity twice. Do you know how to fix that? add_action( ‘wp_footer’, ‘cart_update_qty_script’ ); function cart_update_qty_script() { if (is_cart()) : ?> <script> jQuery(‘div.woocommerce’).on(‘change’, ‘.qty’, function(){ jQuery(“[name=”update_cart”]”).trigger(“click”); … Read more

Use is_product_category() properly

I have two product category MULTILINGUAL DIGITAL MARKETING (ID 75) INTERNATIONAL SALES CHANNELS (ID 107) I want to run some code via if condition for these two category only. I tried using this code but it didn’t worked if( is_product_category(107 || 75) ) { $term = get_queried_object(); $parent = $term->parent; if (!empty($parent)) { $child_of = … Read more