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

Auto update cart after quantity change

Almost one year late, but this question might still get visitors: You trigger the click, but the button doesn’t have enough time to become enabled, so that is why, by the time you click the second time the button becomes enabled. Remove the “disabled” propriety before triggering the click: <script> jQuery(‘div.woocommerce’).on(‘change’, ‘.qty’, function(){ jQuery(“[name=”update_cart”]”).prop(“disabled”, false); … Read more

Use is_product_category() properly

is_product_category() is to be used on woocommerce category archive pages only so first make sure that you are on category archive. instead of category number use category slug name is_product_category(‘category-slug’) no need to run OR(||) condition just use is_product_category(‘category-slug1′,’category-slug2’) to get same output

WooCommerce: Translation lost on AJAX call in Checkout page [closed]

I think I fixed the issue with the following extended function in my plugin: function localize_backend( $locale ) { // set langauge if user is in admin area if( defined( ‘WP_ADMIN’ ) || ( isset( $_REQUEST[‘pwd’] ) && isset( $_REQUEST[‘kau-boys_backend_localization_language’] ) ) ){ // ajax call from frontend if ( ‘admin-ajax.php’ == basename( $_SERVER[ ‘SCRIPT_FILENAME’ … Read more

WooCommerce – Overwrite action hook [closed]

It’s actually pretty simple to change the title in content-product.php, but you won’t be able to do it with a hook. Near the top of the file, you should see this line: Override this template by copying it to yourtheme/woocommerce/content-product.php All you have to do is copy the file to the above directory, replacing “yourtheme” … Read more

Display “add to cart” button on every listing in product category page?

You can use the WooCommerce hook woocommerce_after_add_to_cart_button. This hook will add content after the “Add To Cart” button. If the customer clicks on this button, the product should get added to the cart, and the customer should be send to the checkout page. Add the below code in your child theme functions.php /* Create Buy … Read more