Woocommerce Advanced Shipping (WAS) condition is not being called when selecting “Ship to different address” [closed]

Your code is good and shouldn’t be the issue (as long as the shipping rate is active/published and has the condition). I think its related to the shipping cache; WC doesn’t re-calculate the shipping cost if nothing has changed for the destination (so the billing would be the same as the shipping address). You can … Read more

How to make an edit to an already published post back to Draft

Add below code in your current theme’s functions.php file. You have to replace USER ROLE with your user role name in if condition. function check_edit_post($post_id){ global $post; if( in_array(‘USER ROLE’, wp_get_current_user()->roles) && ‘product’ == get_post_type($post_id) && ‘publish’ == get_post_status($post_id) && $post->post_date != $post->post_modified ){ wp_update_post(array( ‘ID’ => $post_id, ‘post_status’ => ‘draft’ )); } } add_action( … Read more

WooCommerce get_author_posts_url() – Author URL redirecting to shop base

I found! https://wordpress.org/support/topic/how-to-add-author-page-to-custom-user-role/#post-8807168 So in WooCommerce, this is achieved by the following code in wp-content/plugins/woocommerce/includes/wc-user-functions.php: /** * Disable author archives for customers. * * @since 2.5.0 */ function wc_disable_author_archives_for_customers() { global $wp_query, $author; if ( is_author() ) { $user = get_user_by( ‘id’, $author ); if ( isset( $user->roles[0] ) && ‘customer’ === $user->roles[0] ) { … Read more

Cart page displays the price and amount as zero regardless of price entered [closed]

That’s maybe not really the right anwser, but the way to test if prices are pulled into the cart and the way to recalculate cart totals. add_action(‘template_redirect’, ‘test_cart_values’); function test_cart_values(){ $cart_items = WC()->cart->get_cart(); if(is_cart() || is_checkout() ){ var_dump($cart); foreach($cart_items as $item){ if($item[‘line_subtotal’] == ” or $item[‘line_subtotal’] == 0){ $calculate_once_again = true; } } if($calculate_once_again == … Read more