woocommerce_get_price filter hook not working for product variation price

I had to add the filter hook for product variation as well. add_filter( ‘woocommerce_product_get_price’, ‘pr_reseller_price’, 10, 2 ); add_filter( ‘woocommerce_product_variation_get_price’, ‘pr_reseller_price’, 10, 2 ); add_filter( ‘woocommerce_product_get_regular_price’, ‘pr_reseller_price’, 10, 2 ); add_filter( ‘woocommerce_product_get_sale_price’, ‘pr_reseller_price’, 10, 2 );

How to disable users from editing billing address in WooCommerce checkout?

Okay I found a solution after Slack conversation. It is possible to remove the fields from checkout by unsetting them in woocommerce_billing_fields hook and then re-adding the values again to the order from users profile with woocommerce_checkout_posted_data hook. add_filter( ‘woocommerce_checkout_posted_data’, ‘fill_order_billing_details’ ); function fill_order_billing_details( $data ) { $customer_id = get_current_user_id(); $data[‘billing_first_name’] = get_user_meta( $customer_id, ‘billing_first_name’, … Read more

Calling calculate_shipping() with ajax in woocommerce

I also have the same issue when I created a shipping method and what I did is on my function for the ajax call I add something just to have an update on the cart: global $woocommerce; $packages = $woocommerce->cart->get_shipping_packages(); foreach( $packages as $package_key => $package ) { $session_key = ‘shipping_for_package_’.$package_key; $stored_rates = WC()->session->__unset( $session_key … Read more

Woocommerce – disable «place order» until user checks Privacy Policy

I think you should jQuery to enable and disable the checkout button. Please try this script. Put this script in the footer.php. jQuery(window).on(‘load’,function(){ setTimeout(function(){ jQuery(‘#payment #place_order’).attr(“disabled”,”disabled”); console.log(‘Hello’); },1000); }); jQuery(document).on(‘change’,’#privacy_policy_field #privacy_policy’,function() { var ischecked= jQuery(this).is(‘:checked’); if(!ischecked){ jQuery(‘#payment #place_order’).attr(“disabled”,”disabled”); console.log(‘unchecked’); }else{ jQuery(‘#payment #place_order’).removeAttr(“disabled”); console.log(‘checked’); } }); Note: This is tested script for your code.

Woocommerce Shop Price Position

It appears but above the Title and outside the custom div. What am I doing wrong? It’s because woocommerce_template_loop_price() echoes the output. So to fix the problem, just use ?> HTML here <?php instead of echo ‘HTML here’;: function custom_woocommerce_template_loop_product_title() { ?> <div class=”custom-title-wrapper”> <h1 class=”woocommerce-loop-product__title custom-loop-product-title”><?php the_title(); ?></h1> <h2><?php woocommerce_template_loop_price(); ?></h2> </div> <?php } … Read more

Display WooCommerce only in stock sizes product attribute on shop page

To get only available “In stock” displayed sizes, you need something a little more complicated and different: add_action( ‘woocommerce_after_shop_loop_item_title’, ‘display_instock_sizes’, 5 ); function display_instock_sizes() { global $product; if ( $product->is_type(‘variable’) ) { $taxonomy = ‘pa_size’; // The product attribute taxonomy $sizes_array = []; // Initializing // Loop through available variation Ids for the variable product … Read more