Place Order button in Checkout

This question has been answered here. Basically, you want to use a switch statement hooked to the gettext filter. One benefit of this method is, if you need to change more text down the line you can just add another case to the function. For example: add_filter( ‘gettext’, ‘wpsx_replace_text_string’, 20, 3 ); function wpsx_replace_text_string( $translated_text, … Read more

Order list woocommerce Orders based on meta for custom status

I’ve solved my problem myself, thanks function filter_priority_orders($query) { global $pagenow; $qv = $query->query_vars; if ( $pagenow == ‘edit.php’ && isset($qv[‘post_status’]) && $qv[‘post_status’] == ‘wc-priority-order’ && isset($qv[‘post_type’]) && $qv[‘post_type’] == ‘shop_order’ ) { $query->set(‘meta_key’, ‘_priority_list’); $query->set(‘orderby’, ‘meta_value_num’); $query->set(‘order’, ‘ASC’ ); } return $query; } add_filter( ‘pre_get_posts’, ‘filter_priority_orders’ );

Programmatically setting Woocommerce product price

Ok! This is my solution, and (so far) it works: function return_custom_price($price, $product) { $myPrice = 15; global $current_user; $price = $myPrice; $post_id = $post->ID; return $price; } add_filter(‘woocommerce_get_price’, ‘return_custom_price’, 10, 2); It does target every single product in the store, but as the site only has one product, this works fine.

“Cannot read property ‘replace’ of undefined” Javascript error when trying to add attribute terms from add product page [closed]

The problem was a minor bug in the Variation Swatches for WooCommerce plugin, the add term modal html wasn’t being included in the add product page as a result of wrong conditional statement in the class-admin.php file on line 266: if ( $pagenow != ‘post.php’ || ( isset( $post ) && get_post_type( $post->ID ) != … Read more

Edit WooCommerce product content based on category

There’s a couple of ways to do it, you can edit the template file \woocommerce\templates\single-product\title.php directly and change your title format there. Otherwise, you can remove the WordPress hook in your functions.php file and add your own to override it which I borrowed from this answer <?php remove_action( ‘woocommerce_single_product_summary’,’woocommerce_template_single_title’, 5 ); add_action( ‘woocommerce_single_product_summary’, ‘modify_woocommerce_template_single_title’,5 ); … Read more

How to display empty stars on products with woocommerce?

Add the following code to your functions.php add_action(‘woocommerce_after_shop_loop_item_title’,’change_loop_ratings_location’, 2 ); function change_loop_ratings_location(){ remove_action(‘woocommerce_after_shop_loop_item_title’,’woocommerce_template_loop_rating’, 5 ); add_action(‘woocommerce_after_shop_loop_item_title’,’woocommerce_template_loop_rating’, 15 ); } And then after add the following lines also to get the rating count add_filter( ‘woocommerce_product_get_rating_html’, ‘loop_product_get_rating_html’, 20, 3 ); function loop_product_get_rating_html( $html, $rating, $count ){ if ( 0 < $rating && ! is_product() ) { global … Read more